Here is the raw text from my text file (the original source).  It's created 
on a Windows machine (??in case that makes a difference with linefeeds vs. 
carridge returns??) then put on an apache web server.

f|Gimlis Axe|p|fellowship/large/14gimlisbattleaxe.html
f|Hand Axe|p|minesofmoria/large/010handaxe.html
f|Gimlis Helm|p|fellowship/large/15gimlishelm.html
f|Dwarven Armor|p|fellowship/large/8dwarvenarmor.html
f|Dwarven Bracer|p|minesofmoria/large/003dwarvenbracers.html
f|Gandalfs Staff|p|minesofmoria/large/022gandalfsstaff.html
f|Glamdring|p|fellowship/large/75glamdring.html
f|Sleep Cahadras|d|fellowship/large/84sleepcaradhras.html
f|Axe Strike|d|fellowship/large/3axestrike.html

on http://staff.washington.edu/guru/james.cgi you should be able to see the 
progression of the @Draw array in the large textareas.

Here's something that I need some education on: why is it when I just put 
the @Draw array into a hidden field, does it pass all the data, and when I 
use the code suggested, it only passes the first record?  It seems to me 
from what I've read about CGI.pm that it would take all the hidden fields 
and put them into the @Draw array like I've specified.  Oh well.

Thanks all for your help so far!  It's been educational

----Original Message Follows----
From: fliptop <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: James Woods <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED]
Subject: Re: mysterious leading spaces (same foreach problem w/ more 
details)
Date: Tue, 12 Mar 2002 00:19:50 -0500

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.



_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to