[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Speed question



Ken Williams wrote:

> aml@world.std.com (Andrew M. Langmead) wrote:
> >You might be better of grabbing on key at a time by using the iterator
> >built into the scalar context version of keys().
> >
> >while(defined(my $key = keys %database) ) {
> >  print DUMP "$key\n". ("=" x (length($key)+1))."\n";
> >  print DUMP "$database{$key}\n\n";
> >}
>
> I think you really mean:
>
>     while (my ($key) = each %database) {
>
> (Yes, the boolean case-checking is correct.  Try it with the hash
> %hash = (0,1,2,3,4,5);)
>
> In a scalar context, the keys() function returns the *number* of keys in
> the hash.

Ken,

I get the same results... :-(


--
Giorgio Valoti

MagneticMedia Network


# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org