Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Everyone, I have a CGI script I am using and it currently calls another script which goes through and fills out a form.
system ("test_submit", $tested_on_build_label, $feature, $cr_resolved, + $comments, @temp);

Most of fields are just one line and are being passed strings, however, I have one field that requires multiple lines that are all stored in an array. When I use the WWW::Mechanize command
$agent->field("PATHS", "$ARGV[4]");

Does anyone know why it does not get filled in with all the text in the array and/or how I can get it to do so? Thanks in advance for your help!

Replies are listed 'Best First'.
Re: Filling a textbox with an array in WWW::Mechanize
by moritz (Cardinal) on Jul 30, 2008 at 19:54 UTC
    Calling a function like system flattens the arguments, so the contents will not be in $ARGV[4], but in @ARGV[4..$#ARGV]. So you can try this instead:
    $agent->field("PATHS", join("\n", @ARGV[4..$#ARGV]));
      Thanks for the quick reply. I forgot to mention that when I am passing the array on the submit call the first element (0) in that array will be used for another field. How would I fill in the argument from ARGV4 element 1 ... end of ARGV4. Thanks.
        C:\>perl -le" print $i++,qq-\t$_ - for @ARGV" a b c d e f g 1 2 3 3 3 +3 3 3 0 a 1 b 2 c 3 d 4 e 5 f 6 g 7 1 8 2 9 3 10 3 11 3 12 3 13 3 14 3