Date format in Perl

How do I display the date in the format "YYYY-Mmm-DD" using perl.

e.g 2008-Jun-03

I have a perl command below which displays the date in the format "YYYY-MM-DD" but I want the month to be displayed as "Mmm" (The first 3 characters of the name of the month with the initial letter being upper case)

perl -e '@d=localtime ((stat(shift))[9]); printf "%4d-%02d-%02d\n", $d[5]+1900,$d[4]+1,$d[3]'

Steve

There's no built-in formatting command for that, but it's not hard to roll your own.

@mon = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
printf "%4d-%s-%02d\n", $d[5]+1900, $mon[$d[4]], $d[3];

You may install Date::Format if you prefer a more flexible way of formatting dates.

Date::Format - Date formating subroutines - search.cpan.org