6.7. Process an entire file line by line (while, cat)
Example 6-5. examples/files/cat.pl #!/usr/bin/perl
use strict;
use warnings;
my $filename = "input.txt";
open(my $fh, "<", $filename) or die "Could not open '$filename'\n";
while (my $line = <$fh>) {
print $line;
}
Instead of printing the line you could do anything with it.
|
Follow me: