Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

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]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2018-05-23 04:08 GMT
Find Nodes?
    Voting Booth?