[svn:perlfaq] r10875 - perlfaq/trunk

[email protected] Mon, 3 Mar 2008 11:48:06 -0800 (PST)
Newsgroups perl.cvs.perlfaq
Message-ID <[email protected]>
Author: comdog
Date: Mon Mar  3 11:48:05 2008
New Revision: 10875

Modified:
   perlfaq/trunk/perlfaq4.pod

Log:
* perlfaq4:  How do I manipulate arrays of bits?
	+ Steffen Heinrich pointed out a mismatch between the prose 
	for the first example and what the example already does.
	+ I fixed the code, and elaborated in the prose


Modified: perlfaq/trunk/perlfaq4.pod
==============================================================================
--- perlfaq/trunk/perlfaq4.pod	(original)
+++ perlfaq/trunk/perlfaq4.pod	Mon Mar  3 11:48:05 2008
@@ -1727,7 +1727,9 @@
 set:
 
 	$vec = '';
-	foreach(@ints) { vec($vec,$_,1) = 1 }
+	foreach(@ints) { 
+		vec($vec,$_,1) = 1 if $_;
+		}
 
 Here's how, given a vector in C<$vec>, you can get those bits into your
 C<@ints> array: