I have a script I put together based on another script that I have seen posted here on this site. Basically I want to take a hyphenated date and pass it to my script on STDIN and produce a perl/unix timestamp on STDOUT. But for some reason, the the $timestamp variable isn't showing any output. Can someone help?
#!/usr/bin/perl
use POSIX;
$hyphendate = shift;
($StoredMonth,$StoredDay,$
StoredYear
)=split(/-
/,$hyphend
ate);
$sec = 0;
$min = 0;
$hour = 0;
$mday = $StoredDay;
$mon = $StoredMonth - 1;
$year = $StoredYear - 1900;
$wday = 0;
$timestamp = mktime($sec,$min,$hour,$md
ay,$mon,$y
ear);
print "-> $timestamp <- $hyphendate\n";
Start Free Trial