Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re^9: Split output by tabs (bogus best practice)

by shmem (Chancellor)
on Nov 13, 2012 at 16:03 UTC ( #1003646=note: print w/replies, xml ) Need Help??

in reply to Re^8: Split output by tabs (bogus best practice)
in thread Split output by tabs

Braces are a nice visual cue that make a filehandle variable instantly recognizable as a filehandle.

Guessed that I could whip up an example where it isn't?

qwurx [shmem] ~ > perl -le '$h = {foo => "42"}; print {$h} "foo"' Not a GLOB reference at -e line 1. qwurx [shmem] ~ >


sort {byid} @list; map {$_->()} @stuff; print {$fh||$ofh} @vars;

Braces are no nice visual cue! They mean and do something. Using them uncalled for is either decorative or cargo cult programming.

Note that I'm not averse to the odd drink which is style, I just don't call "best practice" any blurf which doesn't hold water.

Replies are listed 'Best First'.
Re^10: Split output by tabs (best practice?)
by tye (Sage) on Nov 13, 2012 at 17:04 UTC

    You showed an example of how the use of braces forces Perl to try to interpret something as a file handle and to complain that $h is not a file handle (just not as clearly as it might).

    That looks like evidence in support of the claimed "best practice".

    - tye        

      That looks like evidence in support of the claimed "best practice".

      Well, er... sh*t. I blew that one, it seems. Sigh..:)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1003646]
[1nickt]: I am sure I don't know about most of the stuff that is no longer controlled by humans. I do know that it's past the point of determining consumer pricing and into things that can kill me with blunt force!
[holli]: but is this really a problem 1nickt? Nobody knows how your human taxi drivers brain works either
[holli]: at least for cars, if the ai works better than a human on average, by all means let the machines drive

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2017-11-21 13:10 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (301 votes). Check out past polls.