I have this bit of code:
#!/usr/bin/perl -w
$edgar = "/home/Campbell/perl/edgar"
opendir (EDGAR, $edgar) or die "Can't find $edgar!\n";
while ($file = readdir EDGAR) {
open (FILE, ">$file");
print FILE;
}
When I run the program I get this error message:
Use of uninitialized value in print at /home/Campbell/perl/Get.Info line 9
If I change the open line to say
open (FILE, "<$file");
I get this error message:
Filehandle main::FILE opened only for input at /home/Campbell/perl/Get.Info
line 9
I don't understand why it recognizes the file handle in one case and not in
the other, and I don't have the first clue how to fix it. Help? I'm using
perl 5.6.0 on a RedHat 7.1 machine if it means anything.
Thanks,
Campbell