Here's how to read records (lines) from a plain text file in the ASCII character encoding:
use strict; use warnings; use autodie qw( open close ); use English qw( -no_match_vars ); @ARGV == 1 or die "Usage: perl $PROGRAM_NAME <input file>\n"; my $input_file = shift; open my $fh, '<:encoding(ASCII)', $input_file; RECORD: while (my $record = <$fh>) { # Do something with record... } close $fh;
In reply to Re^4: How to read from a .txt
by Jim
in thread How to read from a .txt
by stamp1982
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |