Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: Regular expressions

by ikegami (Patriarch)
on Jul 20, 2005 at 14:56 UTC ( #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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2023-03-31 12:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (75 votes). Check out past polls.

    Notices?