>>>>> "MA" == Mishustin Alexey <shum...@shumkar.ru> 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  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to