[Israel.pm] why did it happen
Yossi Itzkovich
Yossi.Itzkovich at ecitele.com
Wed Jun 20 20:16:11 EEST 2007
Thanks
(and you are correct about the misspelling)
-----Original Message-----
From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On
Behalf Of Ephraim Dan
Sent: Wednesday, June 20, 2007 8:11 PM
To: Perl in Israel
Subject: Re: [Israel.pm] why did it happen
Operator precedence.
?: comes before =, so it's equivalent to:
my $a= ( (27>20)?$a="big":$a) ="small";
so "small" wins
thanks for the fun quiz.
Oh, and I think you mean "colleague"
-----Original Message-----
From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On
Behalf Of Yossi Itzkovich
Sent: Wednesday, June 20, 2007 20:03
To: Perl in Israel
Subject: [Israel.pm] why did it happen
Hi,
A college here wanted to write this code:
my $a=(27>20)?"big":"small";
And instead wrote:
my $a= (27>20)?$a="big":$a="small");
Surprisingly $a was set to "small". Why ?
Yossi
_______________________________________________
Perl mailing list
Perl at perl.org.il
http://perl.org.il/mailman/listinfo/perl
_______________________________________________
Perl mailing list
Perl at perl.org.il
http://perl.org.il/mailman/listinfo/perl
More information about the Perl
mailing list