Is there a better way of doing this?
Thanks!
Dave
if ($in{'price'} eq "") {print '• Missing '; }
elsif (&checkPrice($in{'price'})) {
print '• Wrong Format';
}
sub checkPrice{
if ($_[0] =~ /\$?(\d*)(\.\d{0,2})?/) {
return 1;
} else {
return 0;
}
}
Allowable input:
On Mon, Apr 23, 2001 at 11:38:42AM -0400, David Gilden wrote:
> Is there a better way of doing this?
Hmmm. Where to start? :-)
> Thanks!
> Dave
>
>
>
> if ($in{'price'} eq "") {print '• Missing '; }
> elsif (&checkPrice($in{'price'})) {
> print '• Wrong Format';
> }
>
>
>
>
On Mon, Apr 23, 2001 at 11:38:42AM -0400, David Gilden wrote:
: Is there a better way of doing this?
Dave, here is my take on it, hopefully commented well:
#!/usr/local/bin/perl -w
use strict;
$|++;
while ( ) {
chomp;
print( &validate( $_ ) ? 'valid entry' : 'try again punk' );
print "\
On Mon, Apr 23, 2001 at 01:15:13PM -0400, David Gilden wrote:
[ brought back to the list with permission ]
> my camel learning perl book has hashs with the key in quotes,
> whats going on with this?
In the early days this was necessary, otherwise the key would be
interpreted as a function and i