For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > March 2006 > 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 64M * 1 reasonable to remove the M from the 64?
Baldoni

2006-03-19, 3:55 am


Hello. I have written a script to calculate the number of sectors per
cylinder, blocks, and bytes on a compact flash card. These lines are
used to get input from a user:

my $megs = param("p0");
---
print p('Enter size of card (16, 32, 64, 128, 256) in M here: ');
print start_form(), textfield("p0", "", "4", "4");
print submit("Click to calculate"), end_form();

The variable holding the value entered is $megs. In case someone
(reasonably) enters (e.g.) 64M instead of 64, I say farther down:

$megs *= 1;

Then I check $megs using == against the valid numerical entries. I
don't get any errors in the logs, but yet this just feels too easy.
Maybe it's what makes Perl fun?
--
John
Sponsored Links







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

Copyright 2008 codecomments.com