From: Jarkko Hietaniemi Date: Sat, 8 Dec 2001 17:44:48 +0000 (+0000) Subject: FAQ sync. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=875e5c2f472bbad0194a8468805dfa001e86093d;p=p5sagit%2Fp5-mst-13.2.git FAQ sync. p4raw-id: //depot/perl@13537 --- diff --git a/pod/perlfaq4.pod b/pod/perlfaq4.pod index f602d24..19066f4 100644 --- a/pod/perlfaq4.pod +++ b/pod/perlfaq4.pod @@ -1,6 +1,6 @@ =head1 NAME -perlfaq4 - Data Manipulation ($Revision: 1.8 $, $Date: 2001/11/09 08:06:04 $) +perlfaq4 - Data Manipulation ($Revision: 1.9 $, $Date: 2001/12/07 21:17:58 $) =head1 DESCRIPTION @@ -1635,13 +1635,13 @@ worry you, you can always reverse the hash into a hash of arrays instead: =head2 How can I know how many entries are in a hash? If you mean how many keys, then all you have to do is -take the scalar sense of the keys() function: +use the keys() function in a scalar context: - $num_keys = scalar keys %hash; + $num_keys = keys %hash; -The keys() function also resets the iterator, which in void context is -faster for tied hashes than would be iterating through the whole -hash, one key-value pair at a time. +The keys() function also resets the iterator, which means that you may +see strange results if you use this between uses of other hash operators +such as each(). =head2 How do I sort a hash (optionally by value instead of key)? diff --git a/pod/perlfaq6.pod b/pod/perlfaq6.pod index 58e9708..6ddc0be 100644 --- a/pod/perlfaq6.pod +++ b/pod/perlfaq6.pod @@ -1,6 +1,6 @@ =head1 NAME -perlfaq6 - Regexes ($Revision: 1.4 $, $Date: 2001/11/09 08:06:04 $) +perlfaq6 - Regexes ($Revision: 1.5 $, $Date: 2001/12/02 01:55:12 $) =head1 DESCRIPTION