OK.. first .. if I have the wrong list.. if this list is just about moduals
and apache please forgive.
I thought this list was about moduals, which I am just learning about. This
is a subroutine that is going to go into a package/modual once I get it
working.
ALSO... perl is my HOBBY.... my background is GWbasic and pascal from 20
years ago.
I do not have a degree... so be nice to me.
This piece of code is suppossed to take the Data from the Query string...
$Data = $ENV{QUERY_STRING};
and assign the value to the the vars.
I am trying to move away from the commented out stuff below to something
more strealine.
I want to change my QUERY_STRING from:
ca.cgi?PlayerName=Luinrandir&TownName=Avalon&Location=Castle&Action=Move
to
ca.cgi?Data(2)=Luinrandir&Data(3)=Avalon&Data(5)=Castle
and this is the sub (to be modual) that is going to handle the data.
sub ParseInput # from previous page
{
@pairs = split ( /&/, $Data );
foreach $pair(@pairs)
{
( $name, $value ) = split ( /=/, $pair );
#changes plus sign to space
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
#$name =~ tr/\0//d;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
#$value =~ tr/\0//d;
$form{$name} = $value;
}
### new code???#####
foreach $v0(0 .. 150)
{
if ($Data[$v0] eq "")
{
$Data[$v0] = $form{Data($v0)}; <<<<<<< this line does not work
}
}
#### old code #####
# $Data[2] = $form{PlayerName};
# $Data[3] = $form{TownName};
# $Data[5] = $form{Location};
}