cvs commit: perlfaq perlfaq4.pod

[email protected]
Newsgroups perl.cvs.perlfaq
Message-ID <[email protected]>
cvsuser     02/02/21 06:48:01

  Modified:    .        perlfaq4.pod
  Log:
  * adds another example to 'How can I count the number of occurrences of a substring within a string?'
  
  Revision  Changes    Path
  1.15      +6 -1      perlfaq/perlfaq4.pod
  
  Index: perlfaq4.pod
  ===================================================================
  RCS file: /cvs/public/perlfaq/perlfaq4.pod,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -w -r1.14 -r1.15
  --- perlfaq4.pod	8 Feb 2002 22:30:23 -0000	1.14
  +++ perlfaq4.pod	21 Feb 2002 14:48:01 -0000	1.15
  @@ -1,6 +1,6 @@
   =head1 NAME
   
  -perlfaq4 - Data Manipulation ($Revision: 1.14 $, $Date: 2002/02/08 22:30:23 $)
  +perlfaq4 - Data Manipulation ($Revision: 1.15 $, $Date: 2002/02/21 14:48:01 $)
   
   =head1 DESCRIPTION
   
  @@ -689,6 +689,11 @@
       $string = "-9 55 48 -2 23 -76 4 14 -44";
       while ($string =~ /-\d+/g) { $count++ }
       print "There are $count negative numbers in the string";
  +
  +Another version uses a global match in list context, then assigns the
  +result to a scalar, producing a count of the number of matches.
  +
  +	$count = () = $string =~ /-\d+/g;
   
   =head2 How do I capitalize all the words on one line?
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.