Hi:
I'm trying to get the number of seconds from the epoch into a Ksh script using Perl's timelocal function. (I'm a Perl newbie using Perl version 5.005_3 under Solaris 7).
The string is space delimited: year month day hour minute second.
I'm getting the error:
Month '-1' out of range 0..11 at -e line 11
Apparently, I'm not identifying the arguments correctly. Any idea what I'm don wrong?
Thanks!
Ed
# 0 1 2 3 4 5
#dt="2003 04 06 15 40 21"
dt="2003 04 06 15 40 21"
echo "$dt"|perl -e '
use Time::Local;
###my $epochseconds = timelocal($seconds, $minutes, $hours, $day, $month - 1, $year);
my $epochseconds = timelocal($ARGV[5], $ARGV[4], $ARGV[3], $ARGV[2], $ARGV[1] - 1, $ARGV[0]);
print "$epochseconds\n";
'