Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: reading files from a directory

by kcott (Archbishop)
on Oct 28, 2010 at 06:34 UTC ( [id://867923]=note: print w/replies, xml ) Need Help??


in reply to Re^2: reading files from a directory
in thread reading files from a directory

There's no need to concatenate arguments to print as that function takes a list. In fact, you're actually requesting additional processing: do the concatenation and then do the print. Even worse, if you concatenate multiple arguments you're performing multiple operations; in sort of pseudocode: print A.B.C.D performs A.B, then AB.C, then ABC.D, then print ABCD, while print A,B,C,D is one operation.

As far as style is concerned, I'd say do whatever is easiest to read and maintain. print "X ", $_, "\n"; and print "X $_\n"; are equally valid but, as mentioned above, avoid print "X " . $_ . "\n";.

I note there's a few places where you haven't included a newline (\n) at the end of your print statement. In case you didn't know, print doesn't automatically add one for you; say, on the other hand, does.

-- Ken

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2026-02-11 07:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.