Re: How this works?

2002-02-19 Thread Tushar Kulkarni
portant. I replaced it with '@a' and then I was not getting results like original code which added confusion). Actually I never gave a thought to slice of a hash. Thanks again, Tushar Sudarsan Raghavan wrote: > Tushar Kulkarni wrote: > > > Hi, > > I have this cod

Re: How this works?

2002-02-19 Thread Tushar Kulkarni
Thanks Kevin, But I am really confused about 'foreach (@a{keys %h})'. What '%h' is doing here? Also I was under impression that '$_' is a copy of $a[0] ..$a[n] (or actually whatever we are using, - depends on context) , but here if I modify $_ it modifies actual variable. So is it alias?

How this works?

2002-02-19 Thread Tushar Kulkarni
Hi, I have this code, but I am not getting how this works. Can someone help? %h = ( one => 15, two => 26, three => 37 ); my @a; foreach (@a {keys %h}) { $_ = $_ + 10; } print "New\n"; foreach (@a{keys %h}) { print "$_\n"; } This prints New 10 10 10 Can s