open (F,"file.txt"); @ar = ; close(F); foreach (@ar) { s/[\n\r\f]//g; # do what you want with the line. }