in reply to Long string needs to be separated
If you want to read a specific number of bytes without regarding to the actual characters, sysread will fit the bill. Something like this should work:
(Warning, I haven't tested this.)open IN, "hugefile.txt" or die "Can't open huge file: $!\n"; open OUT, ">biggerfile.txt" or die "Can't open bigger file: $!\n"; my $line; while (sysread(IN, $line, 150)) { print OUT "$line\n"; } close IN; close OUT;
More info on sysread available here and here.
Update
Look at I0's and jlongino's answers in this thread. They're better answers than mine!
|
|---|