in reply to getting system time

For whatever reason, it changes the return value from localtime() from an array to an array ref. Change to this instead:

(my $sec, my $min, my $hour, my $mday, my $mon, my $year, my $wday, my $yday, my $isdst ) = @{localtime()};

There are probably better ways to manage dates, but I don't have the patience to explain at the moment.

Replies are listed 'Best First'.
Re^2: getting system time
by aaron_baugher (Curate) on Dec 02, 2011 at 17:58 UTC

    The reason, according to perldoc Time::localtime, is that the module replaces the core localtime function which returns an array with one that returns a Time::tm object instead. So you're expected to use the object's methods to get at its values. In this case, since the object is a blessed array reference, treating it as an ordinary array reference also works, but it probably isn't safe to assume it always will.

    Aaron B.
    My Woefully Neglected Blog, where I occasionally mention Perl.