in reply to Re: ** operator in perl
in thread ** operator in perl
I was puzzled by this one too ...
[me@ptmr]/home/me$ perl -le 'print -2 ** 4 ' # ** binds before - -16 [me@ptmr]/home/me$ perl -le 'print (-2) ** 4 ' # this puzzled me -2 [me@ptmr]/home/me$ perl -le 'print ((-2) ** 4)' # parenthesis force wh +at I want 16
but I guess print is handling the second case as a list followed by some irrelevance, do I have that about right ?
Update: Thanks Fletch now I have been enlightened! I last read perlfunc a long time ago and had not really absorbed it all at the time. Now I see the explanation print (something) something_else gives the warning print (...) interpreted as function because it looks like a function.
Cheers,
R.
Pereant, qui ante nos nostra dixerunt!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: ** operator in perl
by Fletch (Bishop) on Feb 03, 2009 at 13:16 UTC |
In Section
Seekers of Perl Wisdom