CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Creating dynamic arrays.

 



tbone587
User

Mar 13, 2012, 3:47 PM

Post #1 of 3 (727 views)
Creating dynamic arrays. Can't Post

If I have an undetermined amount of parameters being passed via cgi how would I dynamically look through the array of parameters and assign a variable like "value_1", "value_2", etc. I tried doing $Value_$Counter but it doesnt work... I am looking for the end result below:
If I enter 3 values via cgi, i need variables as follow

$Value_1 = param('Value_1');
$Value_2 = param('Value_2');
$Value_3 = param('Value_3');


FishMonger
Veteran / Moderator

Mar 13, 2012, 4:20 PM

Post #2 of 3 (726 views)
Re: [tbone587] Creating dynamic arrays. [In reply to] Can't Post

Use a hash.

Code
use strict; 
use warnings;
use CGI;

my $cgi = CGI->new;
my %cgi_params = $cgi->Vars;



tbone587
User

Mar 13, 2012, 7:12 PM

Post #3 of 3 (719 views)
Re: [FishMonger] Creating dynamic arrays. [In reply to] Can't Post

Thank you very much. I appreciate it.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives