http://qs321.pair.com?node_id=522852


in reply to How can you sysread an entire file?

If you really want to put it all in an array at once, use this: @array = split /(?<=\r)/, $rec; If you don't have a compelling need to do that, though, then I would recommend processing it line by line:

while ($rec =~ /([^\r]+\r?)/g) { frobulate($1); }

Both of the above assume that you mean a carriage return, not a newline, when you say carriage return (and that you're not running this on a machine running Mac OS 9 or lower).



If God had meant us to fly, he would *never* have given us the railroads.
    --Michael Flanders