in reply to Re^2: how can I get localtime without mutating any variables
in thread how can I get localtime without mutating any variables

you had the right idea, but better replace $_ with undef

from perlfunc#my-VARLIST

Note that with a parenthesised list, undef can be used as a dummy placeholder, for example to skip assignment of initial values:
my ( undef, $min, $hour ) = localtime;

you can always use undef on the left-hand-side to ignore assignments.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery