On Wed, 2008-08-06 at 08:00 -0500, michael wang wrote:
> Hi,
> 
> if I have something like xxxx20080503, how can I get the date a year ago,
> such as  xxxx20070503 in perl?
> 
> Thanks,
> 
> michael

my $str = 'xxxx20080503';
$str =~ s/(.*)(\d\d\d\d)(\d\d\d\d)$/$1.($2-1).$3/e
print "$str\n";


-- 
Just my 0.00000002 million dollars worth,
  Shawn

"Where there's duct tape, there's hope."

"Perl is the duct tape of the Internet."
        Hassan Schroeder, Sun's first webmaster


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


Reply via email to