in reply to Date Extraction
use strict; use warnings; my @f = ( localtime )[0..5]; my $system_date = sprintf "%d" . "%02d" x 5, $f[5] + 1900, $f[4] + 1, @f[ 3, 2, 1, 0 ]; print $system_date, "\n";
Check the POD for localtime. Also, you may find perldata interesting as it discusses the use of slices. Oh, and I used the 'x' operator (see perlop) and the '.' concatenation operator (also found in perlop) to reduce the sprintf template to something more understandable.
Dave
|
|---|