my $slurp; { local $/ = undef; open my $textfile, '<', 'filename.txt' or die $!; $slurp = <$textfile>; close $textfile; }
The above code is unnecessary. It is syntactically correct if you want to read an entire file into a single scalar variable ($slurp), but then your code needs to use this variable, which it doesn't.
Far better to do this:
open my $textfile, '<', 'filename.txt' or die $!; while ( my $line = <$textfile> ) { ## Do something with $line }
Update: Do you see how much better formated my post looks than yours? That's because I followed the guidelines, wrapping code (and data) in <c>...</c> tags and paragraphs of text in <p>...</p> tags.
There's nothing stopping you from going back and correcting your posts now...
Update: Corrected minor tpyos.
In reply to Re^2: Perl = Greek to me
by Not_a_Number
in thread Perl = Greek to me
by smolikmd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |