use File::Slurp; my $content = read_file('my_file.txt'); for ( split(/[\r\n]+/, $content) ) { print "Found: $_\n"; }