On Mon, Apr 08, 2002 at 09:56:48AM -0700, Andrew O. Mellinger wrote:
> At 6:48 PM +0200 4/8/02, Louis Pouzin wrote:
> >Hi listers,
> >
> >I want to read several text files into a single string.
> >
> >use strict;
> >@ARGV=('fil1','fil2','fil3');
> >my $fil = do{local $/; <>};
> >print $fil;
> >__END__
> >
> >This prints only the contents of fil1.
> 
>   The <> operator reads to the newline.  You have made a local of $/, 
> but haven't changed the value.  You probably want to undef it.

When you localize a variable without initializing it, its local value is
undef.  Thus, it is not necessary to explicitly set $/ to undef in the
above code.

Ronald

Reply via email to