
pmkenned
New User
Jan 3, 2012, 5:17 AM
Post #1 of 3
(2008 views)
|
Undefined Format
|
Can't Post
|
|
Hi, I have a very simple file: #!/usr/bin/perl use strict; use format; my $foo = 2; format LIST = @<<<< $foo . open(FILE, ">foo.txt"); $~ = 'LIST'; print FILE "hello?"; write FILE; ----- For whatever, reason I am getting the following error message: Undefined format "FILE" called at ./test.pl line 16. I am using Perl version 5.005_03 built for x85_64-linux. I also get this error when running version 5.10.1 built for i686-cygwin-thread-multi-64int. The odd thing is that it prints to the file using "print" just fine, but it cannot perform the "write". So, I know the problem is not with the file. When I change the FILE to STDOUT, it prints to the screen successfully, so I know the problem is not with the format. It seems to be only when I attempt to write a format to a file that there is a problem. Any ideas? Thanks in advance.
|