local $/ = "\r\n"; # read with Windows-style endings while () { print "Found: $_"; } #### use File::Slurp; my $content = read_file('my_file.txt'); for ( split(/[\r\n]+/, $content) ) { print "Found: $_\n"; }