That's fine, subject to the hints haukex provided.
Now that you understand the diamond operator (perlop: IO Operators) you can use a modern tool to do the busywork of opening and closing files, character encoding, removing new line characters, error handling, etc.
use strict; use warnings; use feature 'say'; use Path::Tiny; # imports path() my $filename = '/TEXT2.txt'; say for path( $filename )->lines_utf8({ chomp => 1 }); __END__
See also:
Hope this helps!
In reply to Re^3: iterative foreach loop
by 1nickt
in thread iterative foreach loop
by hchana
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |