develooper Front page | perl.perl5.porters | Postings from March 2001

unexpected result of stringification.

From:
Konovalov, Vadim
Date:
March 12, 2001 03:01
Subject:
unexpected result of stringification.
Message ID:
402099F49BEED211999700805FC7359FA268A1@ru0028exch01.spb.lucent.com
Following:

print 'foo'=~/(.*)/ &&  $1,   'bar'=~/(.*)/ && $1,  "\n";
print 'foo'=~/(.*)/ && "$1", 'bar'=~/(.*)/ && "$1", "\n";


results in:

barbar
foobar

which was unexpected to me.
While there may be found a way to explain such behaviour, it may result in
errors that are quite hard to find.

Is this a bug or not?
Is there a way to fix this?

Tried 5.6.0 and 5.005_02 on Win32 and Unix systems.

Best wishes,
<!ENTITY Vadim REALLIFE "Vadim V.Konovalov, St.Petersburg, Russia">
&Vadim;



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