Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^7: Looking for pointers or optimizations.

by chromatic (Archbishop)
on Aug 21, 2012 at 19:59 UTC ( #988840=note: print w/ replies, xml ) Need Help??


in reply to Re^6: Looking for pointers or optimizations.
in thread Looking for pointers or optimizations.

And you could read a file directly in a scalar...

Depending on the current value of the input record separator, you might only get one record. In fact, you'll probably only get one record.


Comment on Re^7: Looking for pointers or optimizations.
Replies are listed 'Best First'.
Re^8: Looking for pointers or optimizations.
by SerZKO (Beadle) on Aug 22, 2012 at 06:16 UTC
    ++ for pointing out this Chromatic.

    But if you just add undef $/; before reading file, then you get it all in a scalar variable

    undef $/; my $words = <$fh>;

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (13)
As of 2015-07-30 12:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls