in reply to Re^2: What's so wrong with this (dereferencing)code? (Symbolic Refs)
in thread What's so wrong with this (dereferencing)code?
Symbolic references are just implicit hash lookups, doing them explicitly is better in the vast majority of cases.
The for-solution you showed is aliasing which has similarities to referencing, but should not be confused.
> Now $_ = zeropad($_) for $sec, $min, $hour, $day, $month;
> OTOH? That's what I'm talking about!
No you weren't.
But FWIW, aliasing it's also feasible with hash values.
Consider
$_ = zeropad($_) for values %time
and revaluate the clarity of concise code.
Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: What's so wrong with this (dereferencing)code? (Aliasing / UPDATED)
by etj (Priest) on Jun 27, 2024 at 10:08 UTC | |
by LanX (Saint) on Jun 27, 2024 at 13:32 UTC | |
by etj (Priest) on Jun 27, 2024 at 13:38 UTC | |
by LanX (Saint) on Jun 27, 2024 at 13:53 UTC |