| Newsgroups |
perl.cvs.perlfaq |
| Message-ID |
<[email protected]> |
cvsuser 02/05/06 06:08:46
Modified: . perlfaq4.pod
Log:
How do I convert between numeric representations?
* added notes on the 0b notation for binary numbers
Revision Changes Path
1.21 +7 -2 perlfaq/perlfaq4.pod
Index: perlfaq4.pod
===================================================================
RCS file: /cvs/public/perlfaq/perlfaq4.pod,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -w -r1.20 -r1.21
--- perlfaq4.pod 7 Apr 2002 18:46:13 -0000 1.20
+++ perlfaq4.pod 6 May 2002 13:08:46 -0000 1.21
@@ -1,6 +1,6 @@
=head1 NAME
-perlfaq4 - Data Manipulation ($Revision: 1.20 $, $Date: 2002/04/07 18:46:13 $)
+perlfaq4 - Data Manipulation ($Revision: 1.21 $, $Date: 2002/05/06 13:08:46 $)
=head1 DESCRIPTION
@@ -135,7 +135,7 @@
optimized for speed on some operations, and for at least some
programmers the notation might be familiar.
-=item B<How do I convert Hexadecimal into decimal:>
+=item B<How do I convert hexadecimal into decimal:>
Using perl's built in conversion of 0x notation:
@@ -213,6 +213,11 @@
$oct = reverse join('', $vec->Chunk_List_Read(3));
=item B<How do I convert from binary to decimal:>
+
+Perl 5.6 lets you write binary numbers directly with
+the 0b notation:
+
+ $number = 0b10110110;
Using pack and ord