On Friday 02 July 2004 15:07, Randy W. Sims wrote: > Wiggins d Anconia wrote: > > > > You can take the list in a scalar context, or force it into a > > scalar context, such as, > > > > my $num = keys %{ $printers{jobs} }; > > > > or the more verbose, > > > > my $num = scalar keys %{ $printers{jobs} }; > > > > 'values' works in place of 'keys' since it is a 1-to-1 > > relationship, keys is my preferred. > > Don't forget the oft forgot and more efficient > > print scalar %hash; > > eg. > > my %hash = ( > A => 1, B => 2, C => 3 > ); > print scalar %hash; > => 3/8
Neither the 3 nor the 8 nor 3 divided by 8 has any relation to the number of keys or number of values in the hash. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>