For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > March 2006 > Re: 64M * 1 reasonable to remove the M from the 64?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: 64M * 1 reasonable to remove the M from the 64?
Paul Lalli

2006-03-21, 9:55 pm

Baldoni wrote:
> Paul Lalli wrote:
>
>
> So sorry to disagree. http://www.perl.com/doc/FMTEYEWTK/is_numeric.html


I have no idea what you think that article told you that makes you
disagree with what I said about your current situation.

The article is simply about converting a string that possibly has
garbage into a number. It has nothing to do with verifying the input
to a CGI form.

As an aside, that article needs some work:
do {
print "Number, please: ";
$answer = <STDIN>;
print "Bad number\n" if $answer == 0;
} until $answer;

That code, when presented with user input of 'foobar', will print out
"Bad number\n" once, and then terminate the loop, leaving $answer as
'foobar'. I have no idea what the author thought that would
accomplish.

I would also like to point out that as far as verifying numbers is
concerned, you would be better off not relying on a document written
(literaly) a decade ago. Instead, consider the CPAN module
Regexp::Common.

Paul Lalli

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com