in reply to Re: Regular expressions
in thread Regular expressions
That's an aweful way of reading a file. It means every line must be pushed onto the stack. The OP's method was better, and the following is even better because it avoids a call to stat and works will all kinds of IO handles:
my $text; { local $/; $text = <DATA>; }
Visually, I prefer
my $text = do { local $/; <DATA> };
but I think I determined the above is equivalent to
my $text; { local $/; my $temp = <DATA>; $text = $temp; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Regular expressions
by GrandFather (Saint) on Jul 20, 2005 at 20:35 UTC |
In Section
Seekers of Perl Wisdom