Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I humbly ask for help on the following matter:
I have a little piece of code, that isn't working properly. It's supposed to take all files from a directory "mail" and print the first line from each of them. But as I run it, it displays the following warning: "use of uninitialized value in print...etc", and, obviously, doesn't print anything. I know, the solution must be simple, but I just can't find it. Thank you in advance, and here's the code:
#/usr/bin/perl use strict; use warnings; opendir (DIR, "\mail"); foreach my $file (readdir DIR){ open WRITE, '<', '$file'; my $text = <WRITE>; print $text; }
|
---|