in reply to how can I get localtime without mutating any variables

TIMTOWTDI but a slice is simple and effective.

#!/usr/bin/env perl use strict; use warnings; my ($min, $hr, $day, $mon, $yr) = (localtime())[1..5]; print "$min $hr $day $mon $yr\n";

🦛

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:34 UTC
    thank you this is what I wanted. I am now going to look into what a slice is.