[thelist] Perl program question
sam foster
potatosculptor at gmail.com
Mon Jun 12 15:57:26 CDT 2006
> > The line
> > $arg =~ m/(\d+\.\d{2})/;
..
> > BTW, I belive you could just use
> > my $total = $q->param('total');
> > to retrieve the total, which would be more reliable.
the point of the pattern match is presumably to trim off any extaneous
characters like whitespace, to leave you with a currency-format
string.
So, better yet would be to:
my $total = ( $q->param('total') =~ m/(\d+\.\d{2})/ );
Even better yet would be to look on CPAN for a module that gives you
true validation and casting of the string input into a currency
format. Its bound to exist (everything exists on CPAN).
I wouldn't be discouraged by this experience, but I would say next
time you cobble something together, do it in PHP - you're likely to
get more help and a little less guesswork from this list.
Sam
More information about the thelist
mailing list