At 10:23 PM 5/8/2001 +0100, Simon Cozens wrote:
>On Tue, May 08, 2001 at 05:08:58PM -0400, Dan Sugalski wrote:
> >    @foo = ({scalar each %some_tied_hash});
> >
> > with the function being called only when you access a particular element?
>
>I'm still confused. Firstly, this doesn't involve first-order blocks, which
>was kinda what the entire question was about.

Well, it's a block in list context, which is what I was shooting for.

>Secondly, it isn't clear what it
>means. "scalar each" in Perl5-think means "return the first element". (Try:
>perl -le '%a=(a=>"b", c=>"d"); print while $_ = scalar each %a')

Odd.

   %foo = (a => 1, b=>2);
   while ($_ = scalar each %foo) {
     print $_, "\n";
   }

does the expected thing. (printing a and b) Which is what I was shooting for.


>Is this not
>merely @foo=(keys %some_tied_hash), which should call the tied functions in
>the same way? Not a convincing example, I'm afraid.

Well, we currently don't call the tied function that way. But yes. (And the 
example was supposed to be illustrative, not convinving)


                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to