[thelist] Perl program question

Portman mrport at sbcglobal.net
Fri Jun 9 13:50:43 CDT 2006


Thank you David. I got the script from a friend and didn't want to 
change too much of it - hence the weird stuff in there. I will look at 
the code again and make the changes (and remove some of the weird stuff 
once it is working).

Thanks for the reply.
Riva

MILLER David R. wrote:
> I don't have time to figure out exactly what you're doing with this
> script, and there are some weird ways you're doing things, but what you
> want to do is get this up and running.
>
> The line
> $arg =~ m/(\d+\.\d{2})/;
> presumably snags the total from the query string. The parentheses in the
> regexp will put the captured value TEMPORARILY in $1. You rely on $1
> later in the script to represent the total, and I think that's the crux
> of your problem.
>
> Try changing the line above to
> my ($total) = $arg =~ m/(\d+\.\d{2})/;
> and then using $total instead of $1 in your calculations and elsewhere.
>
> BTW, I belive you could just use 
> my $total = $q->param('total');
> to retrieve the total, which would be more reliable.
>
> -----------------------------------------
> David R. Miller
> -----------------------------------------



More information about the thelist mailing list