in reply to What's so wrong with this (dereferencing)code?
To achieve your stated immediate aim here of assigning to the variables you just assigned to (this "zero padding" is itself not a great idea, use the proper timestamp idea instead), you'd do:
But that itself won't affect the "timestamp" (how could it?). If you wanted a Unix timestamp with zeroes for those values, you'd just do something like:$_ = zeropad($_) for $sec, $min, $hour, $day, $month;
my ((undef) x 5, $year, $wday, $yday, $isdst) = localtime(time); my $zeroed_ts = timelocal((0) x 5, $year, $wday, $yday, $isdst);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: What's so wrong with this (dereferencing)code?
by Maelstrom (Beadle) on Jun 26, 2024 at 13:01 UTC |