Loading ...
Sorry, an error occurred while loading the content.
 

Re: [PBML] curious problem.. spliting a variable number of possible numbers out of text..

Expand Messages
  • Jonathan E. Paton
    ... ^ escaped bracket, remove or slightly shorter still: my $total = 0; $total += $1 while ($line =~ /( d+(?: . d d)?) /g)); Jonathan Paton
    Message 1 of 8 , Jan 30, 2002
      > ok, so how about this:
      >
      > my $total = 0;
      > while ($line =~ /(\d+(?:\.\d\d)?\)<BR>/g) {
      > $total += $1;
      > }

      You made a slight error:

      > while ($line =~ /(\d+(?:\.\d\d)?\)<BR>/g) {
      ^ escaped bracket, remove
      \

      or slightly shorter still:

      my $total = 0;
      $total += $1 while ($line =~ /(\d+(?:\.\d\d)?)<BR>/g));

      Jonathan Paton

      __________________________________________________
      Do You Yahoo!?
      Everything you'll ever need on one web page
      from News and Sport to Email and Music Charts
      http://uk.my.yahoo.com
    Your message has been successfully submitted and would be delivered to recipients shortly.