cvs commit: perlfaq perlfaq5.pod

[email protected] (brian d foy) 10 Aug 2005 15:55:24 -0000
Newsgroups perl.cvs.perlfaq
Message-ID <[email protected]>
cvsuser     05/08/10 08:55:24

  Modified:    .        perlfaq5.pod
  Log:
  * How can I output my numbers with commas added?
     + mentioned Number::Format
  
  * How can I open a file with a leading ">" or trailing blanks?
     + talk about the 3 argument open()
  
  Revision  Changes    Path
  1.37      +18 -16    perlfaq/perlfaq5.pod
  
  Index: perlfaq5.pod
  ===================================================================
  RCS file: /cvs/public/perlfaq/perlfaq5.pod,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- perlfaq5.pod	22 Apr 2005 19:04:48 -0000	1.36
  +++ perlfaq5.pod	10 Aug 2005 15:55:23 -0000	1.37
  @@ -339,6 +339,13 @@
   
   =head2 How can I output my numbers with commas added?
   
  +(contributed by brian d foy and Benjamin Goldberg)
  +
  +You can use L<Number::Format> to separate places in a number.
  +It handles locale information for those of you who want to insert
  +full stops instead (or anything else that they want to use,
  +really).
  +
   This subroutine will add commas to your number:
   
   	sub commify {
  @@ -482,25 +489,20 @@
   
   =head2 How can I open a file with a leading ">" or trailing blanks?
   
  -Normally perl ignores trailing blanks in filenames, and interprets
  -certain leading characters (or a trailing "|") to mean something
  -special.
  -
  -The three argument form of open() lets you specify the mode
  -separately from the filename.  The open() function treats
  -special mode characters and whitespace in the filename as
  -literals
  +(contributed by Brian McCauley)
   
  +The special two argument form of Perl's open() function ignores
  +trailing blanks in filenames and infers the mode from certain leading
  +characters (or a trailing "|"). In older versions of Perl this was the
  +only version of open() and so it is prevalent in old code and books.
  +
  +Unless you have a particular reason to use the two argument form you
  +should use the three argument form of open() which does not treat any
  +charcters in the filename as special.
  +     
   	open FILE, "<", "  file  ";  # filename is "   file   "
   	open FILE, ">", ">file";     # filename is ">file"
   
  -It may be a lot clearer to use sysopen(), though:
  -
  -    use Fcntl;
  -    $badpath = "<<<something really wicked   ";
  -    sysopen (FH, $badpath, O_WRONLY | O_CREAT | O_TRUNC)
  -	or die "can't open $badpath: $!";
  -
   =head2 How can I reliably rename a file?
   
   If your operating system supports a proper mv(1) utility or its