cvs commit: perlfaq perlfaq4.pod

[email protected] (brian d foy)
Newsgroups perl.cvs.perlfaq
Message-ID <[email protected]>
cvsuser     03/01/26 09:43:21

  Modified:    .        perlfaq4.pod
  Log:
  * added examples that use the * conversion in sprintf
  
  * fixed some literal < characters by turning them into E<lt>
  
  Revision  Changes    Path
  1.40      +10 -10    perlfaq/perlfaq4.pod
  
  Index: perlfaq4.pod
  ===================================================================
  RCS file: /cvs/public/perlfaq/perlfaq4.pod,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -w -r1.39 -r1.40
  --- perlfaq4.pod	3 Jan 2003 20:06:21 -0000	1.39
  +++ perlfaq4.pod	26 Jan 2003 17:43:21 -0000	1.40
  @@ -1,6 +1,6 @@
   =head1 NAME
   
  -perlfaq4 - Data Manipulation ($Revision: 1.39 $, $Date: 2003/01/03 20:06:21 $)
  +perlfaq4 - Data Manipulation ($Revision: 1.40 $, $Date: 2003/01/26 17:43:21 $)
   
   =head1 DESCRIPTION
   
  @@ -142,7 +142,7 @@
   
   =item How do I convert from decimal to hexadecimal
   
  -Using sprint:
  +Using sprintf:
   
       $hex = sprintf("%X", 3735928559);
   
  @@ -811,9 +811,6 @@
   
   =head2 How do I pad a string with blanks or pad a number with zeroes?
   
  -(This answer contributed by Uri Guttman, with kibitzing from
  -Bart Lateur.)
  -
   In the following examples, C<$pad_len> is the length to which you wish
   to pad the string, C<$text> or C<$num> contains the string to be padded,
   and C<$pad_char> contains the padding character. You can use a single
  @@ -829,12 +826,15 @@
   
       # Left padding a string with blanks (no truncation):
       $padded = sprintf("%${pad_len}s", $text);
  +	$padded = sprintf("%*s", $pad_len, $text);  # same thing
   
       # Right padding a string with blanks (no truncation):
       $padded = sprintf("%-${pad_len}s", $text);
  +	$padded = sprintf("%-*s", $pad_len, $text); # same thing
   
       # Left padding a number with 0 (no truncation):
       $padded = sprintf("%0${pad_len}d", $num);
  +	$padded = sprintf("%0*d", $pad_len, $num); # same thing
   
       # Right padding a string with blanks using pack (will truncate):
       $padded = pack("A$pad_len",$text);
  @@ -958,13 +958,13 @@
       print "@lines";		# WRONG - extra blanks
       print @lines;		# right
   
  -=head2 Why don't my <<HERE documents work?
  +=head2 Why don't my E<lt>E<lt>HERE documents work?
   
   Check for these three things:
   
   =over 4
   
  -=item There must be no space after the << part.
  +=item There must be no space after the E<lt>E<lt> part.
   
   =item There (probably) should be a semicolon at the end.
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.