use strict; open(FH, "really_big_file") or die("doh - $!"); my $filestr = do { local $/; }; $filestr =~ s/(.{150})/$1\n/gs;