in reply to Problems to use strict with dynamic $$variable

"Doctor, my arm is in a cast."
"I see."
"And it hurts when I try to bend my arm in the cast."
"Well then, don't wear the cast!"

You're using strict, but doing that which it specifically denies. You shouldn't be using variables like $a0, $a1, $a2, etc., anyway. That's what arrays (or hashes) are for.

Families of variables are best treated as arrays or hashes, 95% of the time. Just ask Dominus. He gave a great talk at my office last week on "red flags" -- things which should stand out in your code as places of improvement. One such thing was families of variables.

He also has a great document on his web site about creating variable names dynamically, like you are. It's not a good idea -- again, arrays and hashes are far safer.

japhy -- Perl and Regex Hacker
  • Comment on Re: Problems to use strict with dynamic $$variable