Urvish Jain 写道:
> Hi all,
>
> I'm new to community as well as perl programming language. I have a perl
> script with me and I need to execute it for creating rr database (rrd), Has
> anybody worked on this before. Please help!
>
Hello,
Welcome to this list.
As a perl programmer, you may lear
ng
Cc: beginners@perl.org
Subject: Re: date info
michael wang 写道:
> Hi,
>
> if I have something like 20080503, how can I get the date a year ago,
> such as 20070503 in perl?
>
you may extract the exact date from the original string (ie, use a
regex), then convert it to any
- Original Message -
From: ""michael wang"" <[EMAIL PROTECTED]>
Newsgroups: perl.beginners
To:
Sent: Wednesday, August 06, 2008 9:00 AM
Subject: date info
Hi,
if I have something like 20080503, how can I get the date a year ago,
such as 20070503 in perl?
Thanks,
michael
michael wang wrote:
>
> if I have something like 20080503, how can I get the date a year ago,
> such as 20070503 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 unsubscrib
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 20080503, how can I get the date a year ago,
> > such as 20070503 in perl?
> >
> > Thanks,
> >
> > michael
>
> my $str = '20080503
On Wed, 2008-08-06 at 08:00 -0500, michael wang wrote:
> Hi,
>
> if I have something like 20080503, how can I get the date a year ago,
> such as 20070503 in perl?
>
> Thanks,
>
> michael
my $str = '20080503';
$str =~ s/(.*)(\d\d\d\d)(\d\d\d\d)$/$1.($2-1).$3/e
print "$str\n";
--
michael wang 写道:
> Hi,
>
> if I have something like 20080503, how can I get the date a year ago,
> such as 20070503 in perl?
>
you may extract the exact date from the original string (ie, use a
regex), then convert it to any date form you wanted (use POSIX::strftime
or something like th