cvs commit: perlfaq perlfaq4.pod

[email protected]
Newsgroups perl.cvs.perlfaq
Message-ID <[email protected]>
cvsuser     02/08/17 10:07:33

  Modified:    .        perlfaq4.pod
  Log:
  * Why isn't my octal data interpreted correctly?
     + mentioned binary literals too
     + excise dec -> hex example (answered elsewhere in faq)
     + this looks like a big change because i had to rewrap the paragraph,
     but's it's really not that drastic.
  
  * How do I handle binary data correctly?
     + removed Microsoft bashing comments
  
  Revision  Changes    Path
  1.28      +12 -15    perlfaq/perlfaq4.pod
  
  Index: perlfaq4.pod
  ===================================================================
  RCS file: /cvs/public/perlfaq/perlfaq4.pod,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -w -r1.27 -r1.28
  --- perlfaq4.pod	13 Aug 2002 11:48:46 -0000	1.27
  +++ perlfaq4.pod	17 Aug 2002 17:07:33 -0000	1.28
  @@ -1,6 +1,6 @@
   =head1 NAME
   
  -perlfaq4 - Data Manipulation ($Revision: 1.27 $, $Date: 2002/08/13 11:48:46 $)
  +perlfaq4 - Data Manipulation ($Revision: 1.28 $, $Date: 2002/08/17 17:07:33 $)
   
   =head1 DESCRIPTION
   
  @@ -49,18 +49,17 @@
   
   =head2 Why isn't my octal data interpreted correctly?
   
  -Perl only understands octal and hex numbers as such when they occur
  -as literals in your program.  Octal literals in perl must start with 
  -a leading "0" and hexadecimal literals must start with a leading "0x".
  +Perl only understands octal and hex numbers as such when they occur as
  +literals in your program.  Octal literals in perl must start with a
  +leading "0" and hexadecimal literals must start with a leading "0x".
   If they are read in from somewhere and assigned, no automatic 
   conversion takes place.  You must explicitly use oct() or hex() if you 
  -want the values converted to decimal.  oct() interprets
  -both hex ("0x350") numbers and octal ones ("0350" or even without the
  -leading "0", like "377"), while hex() only converts hexadecimal ones,
  -with or without a leading "0x", like "0x255", "3A", "ff", or "deadbeef".
  +want the values converted to decimal.  oct() interprets hex ("0x350"),
  +octal ("0350" or even without the leading "0", like "377") and binary
  +("0b1010") numbers, while hex() only converts hexadecimal ones, with
  +or without a leading "0x", like "0x255", "3A", "ff", or "deadbeef".
   The inverse mapping from decimal to octal can be done with either the
  -"%o" or "%O" sprintf() formats.  To get from decimal to hex try either 
  -the "%x" or the "%X" formats to sprintf().
  +"%o" or "%O" sprintf() formats.
   
   This problem shows up most often when people try using chmod(), mkdir(),
   umask(), or sysopen(), which by widespread tradition typically take 
  @@ -1899,9 +1898,7 @@
   
   On less elegant (read: Byzantine) systems, however, you have
   to play tedious games with "text" versus "binary" files.  See
  -L<perlfunc/"binmode"> or L<perlopentut>.  Most of these ancient-thinking
  -systems are curses out of Microsoft, who seem to be committed to putting
  -the backward into backward compatibility.
  +L<perlfunc/"binmode"> or L<perlopentut>.
   
   If you're concerned about 8-bit ASCII data, then see L<perllocale>.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.