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? Is it always.

    I thought I am not that bad in perl but this has really confused me.

Thanks
Tushar



Kevin Old wrote:

> Tushar,
>
> Truthfully, all it really does is print
>
> New
> 10
> 10
> 10
>
> Below, I'll explain it line by line and show you how it really doesn't do
> that much.
>
> This is a hash where the key is "one" and the value is "15"...and so on,
> respectively.
> > %h = ( one => 15,
> >         two => 26,
> >         three => 37 );
>
> All this does is delcare an empty array (a).
> > my @a;
>
> This loops through each item in the array "a" and adds 10 to the value that
> is there (which is nothing).
> It looks like they are attempting to compare the items in the array to the
> items in the hash.
> > foreach (@a {keys %h})
> > {
> >         $_ = $_ + 10;
> > }
> >
>
> This prints the word "New" and a new line character.
> > print "New\n";
> >
>
> This loop prints each item in the array (a).
> > foreach (@a{keys %h})
> > {
> >         print "$_\n";
> > }
>
> Hope this helps,
> Kevin
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to