On Wednesday, June 12, 2002, at 10:46 , Leila Lappin wrote:
[..]
> I thought getting the date would be like how it's in a shell script `date`
>  but it does not seem to be working.  Could someone please advise me on 
> this I tried searching archives on "date" but didn't get anything useful.
>   It's possible I'm looking in the wrong place.


there are possibly two issues here - the first suite I
believe have already been answered with the standards,
although I must add

        perldoc Time::localtime

if you are more 'oo' in your approach.

The second problem is whether or not you were doing one of the
classic 'cut over to perl' issues of how do I invoke an external
shell command a la

        vladimir: 61:] sh
        $ DTG=`date`
        $ echo $DTG
        Wed Jun 12 08:53:16 PDT 2002
        $ perl -e 'my $DTG =`date` ; print $DTG'
        Wed Jun 12 08:54:23 PDT 2002
        $

you will note that in the 'command line' version of 'perl -e'
I have done what many would consider 'overkill' since I have
provide

        my $DTG = `date`;

since of course as you grow more accustom to doing things in
perl you will of course want to use strict and the '-w' flag.

but what you mostly want is really

        $ perl -e 'my $DTG=localtime() ; print "$DTG\n";'
        Wed Jun 12 09:00:01 2002
        $ perl -MTime::localtime -e 'my $now = ctime(); print "$now\n";'
        Wed Jun 12 09:04:34 2002
        $

HTH


ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to