Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^7: Split output by tabs

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


in reply to Re^6: 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.

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1003621]
help
Chatterbox?
[Tanktalus]: clobbering common::sense altogether looks smarter than what I did :)
[Tanktalus]: also, would it not have been a simpler patch to try to get the XS code compiled in C99+ mode for all the comments? :)
[Tux]: C99 is not supported on HP-UX before 11.31
[Tux]: at least not reliable. And perl itself requires C89 (but probes if it can safely use some C99 features)

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2017-09-20 16:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (237 votes). Check out past polls.

    Notices?