develooper Front page | perl.perl5.porters | Postings from November 2003

Re: [perl #24508] Wrong assignment in nested assignment together with subroutine ca ll

Thread Previous | Thread Next
From:
Jeff 'japhy' Pinyan
Date:
November 17, 2003 19:26
Subject:
Re: [perl #24508] Wrong assignment in nested assignment together with subroutine ca ll
Message ID:
Pine.LNX.4.44.0311172223140.29522-100000@perlmonk.org
On Nov 17, Moeller Wolf-Dietrich said:

>Wrong assignment in nested assignment together with subroutine call.
>
>Given one assignment with a concatenation on the right hand side.
>The first term of this concatenation is an assignment of a concatenation,
>enclosed in parentheses.

This only happens with lexicals.

  my ($A, $B);
  $B = ($A = '' . foo()) . "y";
  $D = ($C = '' . foo()) . "y";
  print "$A,$B\n";  # xy,xy
  print "$C,$D\n";  # x,xy

  sub foo { "x" }

-- 
Jeff "japhy" Pinyan      japhy@pobox.com      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]



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