in reply to CGI type question involving arrays..
This will give you access to params without having to know if they came in on a post or a get and without having to monkey around with environment variables.
As for your code snipit:
The line starting with a pound is a comment, but I suspect you knew that. (Its also wrong... you can't $# a hash.) So I'm going to drop it and just look at the other line. Thats trying to dereference an array, which you might want to do explicitly:foreach $thing (keys(%INPUT)) { if(ref($INPUT{$thing}) eq "ARRAY") { $INPUT{$thing} = join('^' +, $$INPUT{$thing}); } # if($#INPUT{$thing}) { $INPUT{$thing} = join('^', $$INPUT{$thin +g}); } }
foreach $thing ( keys %INPUT ) { if( ref( $INPUT{$thing} ) eq "ARRAY" ) { $INPUT{$thing} = join '^', @{$INPUT{$thing}} } } # You can also write the above like this: $INPUT{$_} = join '^', @{$INPUT{$_}} for grep {"ARRAY" eq ref $INPUT{$ +_}} keys %INPUT
|
|---|