http://www.perlmonks.org?node_id=559085


in reply to looping through variables

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^2: looping through variables
by davido (Cardinal) on Jul 04, 2006 at 05:19 UTC

    That's not the standard way, it's one of the standard mistakes.

    Decades of advances in computer science have gotten us to a point where dangerous practices such as "variable names for variables" (symbolic references) are usually superceeded by better, safer, saner alternatives. It's irresponsible to misrepresent symbolic references as the "standard way" to do something that really ought to be done with an array, a hash, or first class references.

    Just because Perl makes it possible to write fragile, bug prone, unsafe code doesn't mean doing so is necessarily the standard for Perl. To the contrary, living up to the standards of Perlish best practices dictates that the use of symbolic references is to be avoided in production code. Forget they exist, and you'll be in much better shape. Leave their use to the people who wrote Exporter, and other gluttons for punishment.

    I certanly hope the OP has the sense to listen to the voices of reason here, avoiding the use of symbolic references in favor of better strategies. I hope that your advice will be ignored, despite its apparent simplicity. That simplicity is dangerously seductive. The reality is that what appears simple at the outset can lead to hellish difficulty down the road.


    Dave

    A reply falls below the community's threshold of quality. You may see it by logging in.