On 8/6/08, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote:

> 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";
>
> this answer my question. Thanks a lot.



Michael

--
> 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
>
>

Reply via email to