Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^3: how can I get localtime without mutating any variables

by LanX (Saint)
on Jan 06, 2021 at 20:45 UTC ( [id://11126471]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11126471]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-19 23:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found