in reply to Re (tilly) 5: Declaring and initializing a hash with a list of keys and a list of values
in thread Declaring and initializing a hash with a list of keys and a list of values

Huh? *I* would expect A for B similar to for(B){A}, and not  for (A) {B}. Your second example shows the my in the loop, where a block semantic can be simply defined. That this *possible* block semantic is not defined and your map-Example suffers only from the explicitly defined (see the curlys) block is a not so surprising *equivalence*. The only difference is in the eye of the beholder.
  • Comment on Re: Re (tilly) 5: Declaring and initializing a hash with a list of keys and a list of values
  • Select or Download Code

Replies are listed 'Best First'.
Re (tilly) 7: Declaring and initializing a hash with a list of keys and a list of values
by tilly (Archbishop) on May 16, 2001 at 05:00 UTC
    I don't know why you are being so hostile, but I see little point in continuing.

    Yes, I had a thinko and switched A and B once. BFD. As for the rest run the following code and observe the scoping carefully:

    for (my $foo) { $_ = "In scope"; print "Inside: $foo\n"; } print "Outside: $foo\n";
    If you can get Perl 5.003 and run the same code. Note the differences.

    This change is no larger than it would be to see the inline for loop scoped exactly like a regular for loop. That change would ruin merlyn's snippet. Therefore, knowing about this past change, I raised my concern over whether this specific scoping detail was likely to be safe across releases of Perl. merlyn said point blank that it was a risk, but thought it didn't matter much since so much will change in Perl 6.

    I don't think I have any more to say on this topic. You wanted to know why I asked the question. You have your answer. No matter how stupid you think the question was, both merlyn and danger gave me reason to think that it was not unreasonable...