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

Re^6: Split output by tabs

by choroba (Canon)
on Nov 13, 2012 at 13:58 UTC ( #1003616=note: print w/ replies, xml ) Need Help??


in reply to Re^5: Split output by tabs
in thread Split output by tabs

And now try it with

my %handle = ( out => *STDOUT, err => *STDERR ); print {$handle{out}} "Test\n"; # Not possible without braces.
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re^6: Split output by tabs
Download Code
Replies are listed 'Best First'.
Re^7: Split output by tabs
by shmem (Canon) on Nov 13, 2012 at 14:20 UTC
    And now try it with
    my %handle = ( out => *STDOUT, err => *STDERR ); print {$handle{out}} "Test\n"; # Not possible without braces.

    This is one of the rare cases, in which a BLOCK (which returns a file handle) is needed. For such a rare case, which anyways would have better been written as

    my %handle = ( out => *STDOUT, err => *STDERR ); my $fh = $handle{out}; print $fh "Test\n"; # Look, ma! no curlies at all.

    the appropriate syntax is glorified as "Best Practice"! Oh my.

Re^7: Split output by tabs
by Anonymous Monk on Nov 13, 2012 at 15:06 UTC
    Why? An exception does not make the rule

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (13)
As of 2015-07-07 23:31 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 (93 votes), past polls