Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re^2: Regular expressions

by ikegami (Patriarch)
on Jul 20, 2005 at 14:56 UTC ( [id://476515]=note: print w/replies, xml ) Need Help??

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

    The reason I am a monk is to learn from the masters. I keep forgetting about $/! I hope I have learned :). Thank you.

    Perl is Huffman encoded by design.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://476515]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-16 23:09 GMT
Find Nodes?
    Voting Booth?

    No recent polls found