in reply to Re: creating variables in a loop
in thread creating variables in a loop

my $q[ $cnt ]
That's definitely not going to work.

eval(
My goodness. Did you forget what I said to you just a few hours ago?

-1 vote on this node too. STOP USING EVAL.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Replies are listed 'Best First'.
Re^3: creating variables in a loop
by mrborisguy (Hermit) on May 18, 2005 at 22:54 UTC

    Yes, of course I remember what you said. In this case, in my example, it's not a security flaw. I can tell you exactly what $cnt is going to be every time, and everything else is escaped.

    I presented it as an answer to his question. I thought your bias on eval was because of security, not absolutely against any use of eval, but maybe I was mistaken?

    -Bryan

      never never never use eval $string. Clearer now?

      When you use eval $string, you fire up a compiler. And there's no point, because every part of this is known by the time you are executing this code.

      You're also using eval to get around "use strict", so even if it's not objectionable on a security basis, it's objectionable on a never never never use "variable variables" basis.

      -- Randal L. Schwartz, Perl hacker
      Be sure to read my standard disclaimer if this is a reply.