Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Dynamic Variable Names?

by dragonchild (Archbishop)
on Jul 23, 2002 at 15:32 UTC ( [id://184450]=note: print w/replies, xml ) Need Help??


in reply to Dynamic Variable Names?

To do exactly what you're trying to do, do something like:
for my $i (0 .. $MAX_ROWS - 1) { push @fee, ${"foo_$i"}; }

That said, DON'T DO IT THAT WAY.

That is what's called a "soft reference". Since you're coming from the web, you should know it's a security leak. Taint-checking fails that. strict fails that. (You are using string and -T, right?)

As for a better solution, you need to change your form. CGI should be able to handle arrays. (You are using CGI, right?)

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://184450]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-16 22:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found