Re: [expert] OT: perl question

2000-05-08 Thread Charles Curley

On Mon, May 08, 2000 at 12:33:50PM -0600, Vincent Danen wrote:
-> Is anyone out there really good with perl?  I'm having some trouble with a
-> CGI script I'm writing and am hoping someone can help me (sorry for this
-> being slightly OT).  What I'm trying to accomplish is a way to parse input
-> strings using arrays.  I originally had:
-> 
-> @convfrom = ("%40", "%2F", ...);
-> @convto = ("@", "/", ...);
-> 
-> $count = 0;
-> foreach $T (@convfrom) {
->   @value1 = split(/\$convfrom[$count]/,$value1[1]);
->   $value1 = join("$convto[$count]",@value1);
->   $count++;
-> }
-> 
-> But this doesn't seem to export the value of $value1 or @value one outside
-> of the foreach statement, so then I tried:
-> 
-> $count = 0;
-> do {
->   @value1 = split(/\$convfrom[$count]/,$value1[1]);
->   $value1 = join("$convto[$count]",@value1);
->   $count++;
-> } while ($count < $convtotal);
-> 
-> But this still doesn't work.  For some reason, I don't think that I can
-> use split and join the way I am with these array variables.  Does anyone
-> know a proper way to do this, or a better way to do it?
-> 
-> Please email me back directly, and again, sorry for the OT post but I
-> didn't know where else to post it.  =)  Thanks!

First thing to do is get the CGI-lib perl module or equivalent. CGI-lib
has a function which parses your input into a handy associative array,
which I think is preferable to what you are trying to do here.

Then check CPAN for other web related modules. Chances are whatever you
want to do has already been done & is on CPAN.

Then go read the recent archives of this list for how annoying we find the
list problems to be, and fix 'em. Thanks.

-- 

-- C^2

No windows were crashed in the making of this email.

Looking for fine software and/or web pages?
http://w3.trib.com/~ccurley



[expert] OT: perl question

2000-05-08 Thread Vincent Danen

Is anyone out there really good with perl?  I'm having some trouble with a
CGI script I'm writing and am hoping someone can help me (sorry for this
being slightly OT).  What I'm trying to accomplish is a way to parse input
strings using arrays.  I originally had:

@convfrom = ("%40", "%2F", ...);
@convto = ("@", "/", ...);

$count = 0;
foreach $T (@convfrom) {
  @value1 = split(/\$convfrom[$count]/,$value1[1]);
  $value1 = join("$convto[$count]",@value1);
  $count++;
}

But this doesn't seem to export the value of $value1 or @value one outside
of the foreach statement, so then I tried:

$count = 0;
do {
  @value1 = split(/\$convfrom[$count]/,$value1[1]);
  $value1 = join("$convto[$count]",@value1);
  $count++;
} while ($count < $convtotal);

But this still doesn't work.  For some reason, I don't think that I can
use split and join the way I am with these array variables.  Does anyone
know a proper way to do this, or a better way to do it?

Please email me back directly, and again, sorry for the OT post but I
didn't know where else to post it.  =)  Thanks!

-- 
[EMAIL PROTECTED], OpenPGP key available on www.keyserver.net
Freezer Burn BBS:  telnet://bbs.freezer-burn.org . ICQ: 54924721
Webmaster for the Linux Portal Site Freezer Burn:  http://www.freezer-burn.org