RE: foreach() index scoping question

2002-02-19 Thread Nikola Janceski
} >$hash{$temp}->{'foo'} = 42;## now it works >} -Original Message- From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 19, 2002 1:14 PM To: Bradford Ritchie Cc: [EMAIL PROTECTED] Subject: Re: foreach() index scoping question

Re: foreach() index scoping question

2002-02-19 Thread Jeff 'japhy' Pinyan
On Feb 19, Bradford Ritchie said: >foreach my $elem (@long_list) { >my $k="junk"; >foreach $k (keys %hash) { > last if($elem =~ /$k/);## ok, I've got the $k I need >} >$hash{$k}->{'foo'} = 42;## oops, $k is reset to "junk" >} That behavior is documented, yes. P