in reply to Reading entire file into scalar: speed differences?

Assuming it works on your OS and for your particular file, the following code will be faster than either of your options above:
sysread SITE, my $xml, -s SITE;
See the discussion (including benchmarks) at Slurp a file

-Blake

Replies are listed 'Best First'.
Re: Re: Reading entire file into scalar: speed differences?
by japhy (Canon) on Jan 25, 2002 at 05:57 UTC
    I'm credited for that idiom in "Perl for System Administration". :)

    _____________________________________________________
    Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
    s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;