James Woods wrote:
> I used the following code to write out all my hidden fields. It didn't
> get rid of the newline or caridge return characters at the end though.
>
> foreach my $item (@Draw){
> my $counter = 0;
> my $daValue = $item;
> chomp($daValue);
> print "<input type='hidden' name='drawHidden' value='$daValue'>\n";
> $counter++;
> }
>
> I accessed and created the array with this code:
>
> my @Draw = $cgi->param("drawHidden") || "";
>
> Any ideas why I can't get rid of the ending characters? (besides the
> fact that I really have no idea what I'm doing? 8^)
well i don't know offhand - i'd have to examine what's in @Draw. i'd
suspect you may have more in there than chomp() can handle. can you
post an example portion of @Draw that displays the strange behavior?
btw, your loop can be rewritten as such:
foreach (@Draw) {
chomp;
print "<input type='hidden' name='drawHidden' value='$_'>\n";
}
or like this:
map {
chomp;
print "<input type='hidden' name='drawHidden' value='$_'>\n";
} @Draw;
without all that $item/$counter stuff. i don't understand what the
$counter is for anyway since you're setting it to 0 on each loop iteration.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]