use warnings; use strict; open my $fh, '<', "file.txt" or die "can't open the flippin' flabergastin' file!: $!"; while (my $line = <$fh>){ chomp $line; print "something here $line\n"; }