Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

$date = scalar(localtime(time)); print "$date\n"; OUTPUT: Fri Mar 8 08:47:42 2002
How can I get the output to be:
Mar 8, 2002

Replies are listed 'Best First'.
Re: Date manipulation
by Juerd (Abbot) on Mar 08, 2002 at 13:53 UTC
    And if you really want to manipulate:

    44696420796F7520732F2F2F65206F
    7220756E7061636B3F202F6D736720
    6D6521203A29202D2D204A75657264
    

Re: Date manipulation
by Kanji (Parson) on Mar 08, 2002 at 14:07 UTC

    As Juerd suggests, I think strftime is the best way to go simply for flexibility, but another way to do it is ...

    printf "%s %d, %d\n", ( split " " => scalar localtime )[1,2,4];

    Or $date = sprintf ... if you need it as a var.

        --k.