in reply to dynamically creating variables named after the contents of an array

And if you "want" to do that, I don't "want" to ever have to maintain your code, or hire you as a programmer working for me.

"variable variables" is definitely the wrong way to go in Perl. It can be done (Perl can do nearly anything), but your maintenance programmer will hunt you down and kill you.

As others have suggested in this thread, a hash of arrayrefs is the way to go.

Do not pollute metadata (variable names) with user data (values). Ever.

-- Randal L. Schwartz, Perl hacker

  • Comment on •Re: dynamically creating variables named after the contents of an array

Replies are listed 'Best First'.
Re: •Re: dynamically creating variables named after the contents of an array
by ignatz (Vicar) on Sep 06, 2002 at 19:22 UTC
    > but your maintenance programmer will hunt you down
    > and kill you.

    We can do that?!!

    I just had this wonderful vision of being a contestant on a game show (maybe Payback or something like that. Most likely a Fox show) chasing down a few programmers who work for a fortune 500 company that shall go nameless. But... then I realized that probably over at XOOM.it there's somebody cursing me in ways I can't even understand, wishing they could do the same thing to me.

    Look... if you're out there reading this, I'm really, really sorry. It was my first gig and I didn't know what the hell I was doing but still... you got to admit... there are some kewl things about it. No?

    ()-()
     \"/
      `                                                     
    
A reply falls below the community's threshold of quality. You may see it by logging in.