in reply to Long string needs to be separated
This puts the whole file in $filestr, then sticks a \n after every 150 characters. After that you'll probably want to put $filestr somewhere (probably not the original file in case you trample the data :-)use strict; open(FH, "really_big_file") or die("doh - $!"); my $filestr = do { local $/; <FH> }; $filestr =~ s/(.{150})/$1\n/gs;
broquaint
Update: Ok, per trs80's node I should warn you that this is not a great solution as it will undoubtedly be quite slow and take up large amounts of memory (i.e > than the 25MB file size). But if you've got time and hardware on your hands, TMTOWTDI.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Long string needs to be separated
by trs80 (Priest) on Feb 13, 2002 at 17:03 UTC |