in reply to Re^4: Split output by tabs
in thread Split output by tabs
There is nothing wrong with adding clarity to a statement that may otherwise be confusing or ambiguous. And there is nothing wrong with reducing the number of rules someone needs to know in order to correctly decipher a statement.
How does it add clarity or reduce the number or rules?
print FILEHANDLE LIST print FILEHANDLE print LIST
print { EXPR } LIST is not on the list at all
Where is the ambiguity?
print $fh map { "$_\n" } @list; print {$fh} map { "$_\n" } @list; $fh->print( map { "$_\n" } @list ); print( $fh map { "$_\n" } @list ); print( {$fh} map { "$_\n" } @list ); print $fh @list; print {$fh} @list; $fh->print( @list ); print( $fh @list ); print( {$fh} @list );
This is just such a case, because an argument given to print can start with either a filehandle or a variable. Depending on what follows, it can be very hard to tell which is intended without braces.
They're both called filehandles, both STDOUT and $fh, the first argument to print is always an optional filehandle followed by a LIST
STDOUT is a bareword filehandle and $fh is a lexical-scalar filehandle
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Split output by tabs
by choroba (Cardinal) on Nov 13, 2012 at 13:58 UTC | |
by shmem (Chancellor) on Nov 13, 2012 at 14:20 UTC | |
by Anonymous Monk on Nov 13, 2012 at 15:06 UTC | |
|
Re^6: Split output by tabs
by ColonelPanic (Friar) on Nov 13, 2012 at 14:13 UTC | |
by shmem (Chancellor) on Nov 13, 2012 at 14:48 UTC | |
by ColonelPanic (Friar) on Nov 13, 2012 at 15:36 UTC | |
by shmem (Chancellor) on Nov 13, 2012 at 16:03 UTC | |
by tye (Sage) on Nov 13, 2012 at 17:04 UTC | |
| |
by Anonymous Monk on Nov 13, 2012 at 15:01 UTC | |
by ColonelPanic (Friar) on Nov 13, 2012 at 15:19 UTC | |
by Anonymous Monk on Nov 13, 2012 at 15:33 UTC |