Process an entire file line by line (while, cat)



examples/files-perl/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.