develooper Front page | perl.perl5.porters | Postings from April 2006

Re: [perl #38935] "map" sometimes uses only the last mapped value

Thread Previous
From:
andreas.koenig.gmwojprw
Date:
April 18, 2006 12:43
Subject:
Re: [perl #38935] "map" sometimes uses only the last mapped value
Message ID:
87u08qk72i.fsf@k75.linux.bogus
>>>>> On Tue, 18 Apr 2006 00:47:29 +0100, Dave Mitchell <davem@iabyn.com> said:

 >> Looks like this came in somewhere during 5.005.  From the perls I have
 >> lying around the operation is correct in 5.004_05 but not in 5.005_04.
 >> It is still a problem in bleadperl.

  > Looks like the TARG in pp_stringify is getting shared

binary search shows it's broken by 1789. Wow what a historic patch:)

----Program----
sub f1 {
  my ($f) = @_;
  my @z = ("$f");
  for my $d (@z) {return $d}
}

sub f2 {
  my ($f) = @_;
  for my $d ("$f") {return $d}
}

sub f3 {
  for my $d (@_) {return $d}
}

print map {f1($_)} qw(x y z); print "\n";
print map {f2($_)} qw(x y z); print "\n";
print map {f3($_)} qw(x y z); print "\n";

for my $a (qw(x y z)) { print f1($a) } print "\n";
for my $a (qw(x y z)) { print f2($a) } print "\n";
for my $a (qw(x y z)) { print f3($a) } print "\n";

----Output of ...skTqpK/perl-5.005_51@1788/bin/perl----
xyz
xyz
xyz
xyz
xyz
xyz

----EOF ($?='0')----
----Output of ...dkeHLI/perl-5.005_51@1789/bin/perl----
xyz
zzz
xyz
xyz
xyz
xyz

----EOF ($?='0')----


Change 1789 by gsar@aatma on 1998/09/18 18:01:37

	delay freeing itervar so C<for $i (@a) { return($i) }> works



-- 
andreas

Thread Previous


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