in reply to how can I get localtime without mutating any variables
Presuming your problem is that you don't want the pieces where you're now using $_ you'd either use undef in those locations, or use a slice and pull out just the ones you're actually interested in; e.g.
(undef, $min, $hr, $day, $mon, $year) = localtime(); ($min, $hr) = (localtime())[1,2];
You may also want to consider DateTime or Time::Piece to provide an object interface instead.
The cake is a lie.
The cake is a lie.
The cake is a lie.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: how can I get localtime without mutating any variables
by thirtySeven (Acolyte) on Jan 06, 2021 at 20:37 UTC | |
by LanX (Saint) on Jan 06, 2021 at 20:45 UTC | |
by Marshall (Canon) on Jan 07, 2021 at 01:05 UTC |
In Section
Seekers of Perl Wisdom