Rob Dixon <[EMAIL PROTECTED]> wrote:
> John W. Krahn wrote:
>>
>> splice() will only work with array not lists.
>
> ... but (as you meant to say, John) you can take a slice
> of a list like this
>
> my ($seconds, $minutes, $hours) = (localtime)[0..2];
And you can take the beginning of the list
John W. Krahn wrote:
> Bernhard Van Staveren wrote:
> >
> > There is an easier way (sorta) to get hours/minutes/seconds;
> >
> > ($seconds, $minutes, $hours)=splice(localtime(), 0, 3);
>
> Did you try this? No, I didn't think so. :-)
>
> splice() will only work with array not lists.
... but (as
Weird... I used it before on my server and it gave me the expected
results - unless someone did a custom job on localtime() or something I
wouldn't know why it did work at the time.
Either that or I'm really confused and I imagined this'd work ;)
(also an option)
On Thu, 5 Jun 2003, John W. Krah
Bernhard Van Staveren wrote:
>
> There is an easier way (sorta) to get hours/minutes/seconds;
>
> ($seconds, $minutes, $hours)=splice(localtime(), 0, 3);
Did you try this? No, I didn't think so. :-)
splice() will only work with array not lists.
John
--
use Perl;
program
fulfillment
--
To
> thanks a lot frank..i think i hav got the thing.
>
> Regards
>
> Saurabh
There is an easier way (sorta) to get hours/minutes/seconds;
($seconds, $minutes, $hours)=splice(localtime(), 0, 3);
--
Bernhard van Staveren - madcat(at)ghostfield.com
GhostField Internet - http://www.gho
thanks a lot frank..i think i hav got the thing.
Regards
Saurabh
--- Frank Wiles <[EMAIL PROTECTED]> wrote:
> .--[ Saurabh Singhvi wrote (2003/06/05 at
> 07:57:14) ]--
> |
> | well i cant understand what the $1, $2 and $3
> do??
> | herez the code
> |
> | #!/usr/local/b
> well i cant understand what the $1, $2 and $3 do??
> herez the code
Howdy
> if ($date =~ /(\d\d):(\d\d):(\d\d)/)
^ ^ ^
$1 $2 $3
The $1,$2,$3 etc hold the parenthesis matched contents in a regex.
HTH
DMuey
--
To unsubscribe, e-mail: [E
.--[ Saurabh Singhvi wrote (2003/06/05 at 07:57:14) ]--
|
| well i cant understand what the $1, $2 and $3 do??
| herez the code
|
| #!/usr/local/bin/perl -w
|
| # Get the date in the standard date format. (ex: Tue
| Oct 24 19:03:03
| 1995 )
| my $date = localtime();
This would be more clear to you
($sec,$min,$hr,$day,$mon,$year)=localtime(time);
$year +=1900;
$mon=$mon+1;
Urmil
-Original Message-
From: Saurabh Singhvi [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 9:57 AM
To: Perl FAq
Subject: Cant seem to understand
well i cant
well i cant understand what the $1, $2 and $3 do??
herez the code
#!/usr/local/bin/perl -w
# Get the date in the standard date format. (ex: Tue
Oct 24 19:03:03
1995 )
my $date = localtime();
# Search through the date looking for the hour,
minute, and second.
if ($date =~ /(\d\d):(\d\d):(\d\d)/)
10 matches
Mail list logo