in reply to How else can I read from a file without using a while loop, testing for the EOF?

Much less dangerous than undef-ing $/ globably (and maybe forgetting to set it back) local-ize it to a block that just does your file reading:
my $string = do{ local $/; <$filehandle> };
Or you can use $RS if you can't (or don't want to) remember $/.

Replies are listed 'Best First'.
Re: Answer: How else can I read from a file without using a while loop, testing for the EOF?
by jdhedden (Deacon) on Apr 24, 2006 at 12:52 UTC
    I like the slurp method provided by IO::All:
    use IO::All; my @lines = io('file.txt')->slurp;