The DATA filehandle is special; it reads from whatever comes after a __DATA__ line in your program. If you want to read from the file specified by $filename instead, you have to open it specifically.
open my $filehandle, '<', $filename or die "Can't read '$filename': $!"; while ( <$filehandle> ) { # etc. } close $filehandle or die "Fail on close '$filename': $!";
In reply to Re^3: split one file into many on finding a new line
by kyle
in thread split one file into many on finding a new line
by smarter_aries
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |