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?

DRY = Don't repeat yourself

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.

Update

> 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
    > Now $_ = zeropad($_) for $sec, $min, $hour, $day, $month;
    > OTOH? That's what I'm talking about!

    No you weren't.

    "That's what I'm talking about!" is an American idiom that expresses delight or approval. He wasn't saying it was the topic of previous remarks.
        Which renders your previous post rather, let's say, confusing?