in reply to print question
print ("a", "b")[1];
does not work, you need an extra pair of ():
print (("a", "b")[1]);
but
print qw(a, b)[1];
works fine without ().
The book I am reading(http://www.perl.org/books/beginning-perl/) says print has higher precedence than 1. But this does not work in the second example with "qw" so I am confused.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: print question
by Anonymous Monk on Aug 16, 2007 at 02:56 UTC | |
by Anonymous Monk on Aug 16, 2007 at 03:03 UTC | |
by liverpole (Monsignor) on Aug 16, 2007 at 03:27 UTC | |
by Anonymous Monk on Aug 16, 2007 at 09:02 UTC | |
by j1n3l0 (Friar) on Aug 16, 2007 at 09:13 UTC |