develooper Front page | perl.perl5.porters | Postings from January 2010

Re: rvalue "statement" given blocks

Thread Previous | Thread Next
From:
Dr.Ruud
Date:
January 4, 2010 11:22
Subject:
Re: rvalue "statement" given blocks
Message ID:
20100103235314.10019.qmail@lists-nntp.develooper.com
Eric Brine wrote:

> do { if (1) { 123 } } + 1   124

perl -wle'
   print do { if (1) { "foo" } } ."bar";
'
foobar


perl -wle'
   print do { if (0) { "foo" } } ."bar";
'
0bar


$ perl -wle'
   print do { if ($ARGV[0]) { "foo" } } ."bar";
' 1
foobar


perl -wle'
   print do { if ($ARGV[0]) { "foo" } } ."bar";
' 0
0bar

-- 
Ruud

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About