>>>>> "MA" == Mishustin Alexey <[email protected]> writes:

  MA> Why do these regexps handle only the first number?


  MA> my $raised_num = 'Tab_10' =~ /^Tab_(.*)$/;
  MA> print $raised_num."\n";

  MA> $raised_num = 'Tab_11' =~ /^Tab_([0-9]+)$/;
  MA> print $raised_num."\n";

  MA> $raised_num = 'Tab_12' =~ /^Tab_([0-9][0-9])$/;
  MA> print $raised_num."\n";

  MA> $ ./test.pl 
  MA> 1
  MA> 1
  MA> 1

try changing the number to something that doesn't start with 1 and see
the results. then come back here for why this is happening.

  MA> But, according to all rules, both numbers must be handled:

  MA> 10
  MA> 11
  MA> 12

you aren't obeying the rules! look carefully at the docs about the
return value of // and how to grab things. my clue above should help.

uri

-- 
Uri Guttman  ------  [email protected]  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to