in reply to Restriction on getting multiline data into a string

You can use the sysread function. Try type perldoc -f sysread and read its documentation.

sysread FILEHANDLE, $scalar, $block_size;
The idea is to determine the size of the file with seek and tell, and then keep reading $block_size number of characters into the scalar, in a loop, until there is no more input.

Replies are listed 'Best First'.
Re: Re: Restriction on getting multiline data into a string
by tilly (Archbishop) on Nov 19, 2003 at 16:08 UTC
    I would suggest using read rather than sysread unless you have a specific reason not to. The main reason being that read cooperates better with other filehandle commands.

    Performance is not a major reason. Performance varies depending on platform and specifics of how you use it. Lots of small calls to sysread should be slower than the same calls to read. On some operating systems and versions of Perl, stdio is slow and so read is slower.