in reply to Date Extraction

perldoc -f localtime should help you; here is your code:
my @time = localtime; my $time = sprintf "%04d" . "%02d" x 5, $time[5] + 1900, # year $time[4] + 1, # month @time[3, 2, 1, 0]; # day, hour, minute, second print $time;

Hope this helped.
CombatSquirrel.

Update: Consider using one of the following modules:

1.) Time::Format. Example:
use Time::Format qw/%time/; my $time = $time{'yyyymmddhhmmss'}; print $time;
2.) Date::Format. Example:
use Date::Format; my $time = strftime "%Y%m%d%H%M%S", @{[localtime]}; print $time;
Cheers.
Entropy is the tendency of everything going to hell.

Replies are listed 'Best First'.
Re: Re: Date Extraction
by Aragorn (Curate) on Dec 18, 2003 at 07:35 UTC
    When dealing with localtime and similar functions, I'd like to name the elements that it returns explicitly:
    my ($sec, $min, $hour, $day, $mon, $year) = (localtime)[0..5]; my $time = sprintf "%04d" . "%02d" x 5, $year + 1900, $mon + 1, $day, $hour, $min, $sec; print $time;
    And presto! Self-documenting code :-)

    Arjen

      Obligatory mention of Time::Piece:
      use Time::Piece; my $t = localtime; printf "%.4d"."%.2d"x5, $t->year, $t->mon, $t->mday, $t->hour, $t->min +, $t->sec;