michael wang wrote:
> 
> if I have something like xxxx20080503, how can I get the date a year ago,
> such as  xxxx20070503 in perl?

If you simply want to subtract one from the first four-digit field found in your
string, then you can write

  $str =~ s/(\d{4})/$1-1/e;

HTH,

Rob

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


Reply via email to