On Jan 29, [EMAIL PROTECTED] said:

>I am sure we could do it in one step as this:
>       $str =~ s/(\d\d\s*)$/$1;

No, that's missing the last /, and all it does is replace what it matches
with itself.

  ($str) = $str =~ /(\d\d\s*)$/;

works, though.

>> $str =~ /(\d\d\s*)$/;
>> $str = $1;

This runs the risk of assigning something COMPLETELY foreign to $str,
because if the regex fails, $1 will hold what it held before the regex.

Mine will assign undef to $str if the regex fails.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to