cvs diff -u -d perlfaq4.pod
Index: perlfaq4.pod
===================================================================
RCS file: /home/perlcvs/perlfaq/perlfaq4.pod,v
retrieving revision 1.8
diff -u -d -r1.8 perlfaq4.pod
--- perlfaq4.pod        2001/11/09 08:06:04     1.8
+++ perlfaq4.pod        2001/12/06 20:25:32
@@ -1635,13 +1635,13 @@
 =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)?
-- 
brian d foy <[EMAIL PROTECTED]> - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html


Reply via email to