I am testing a small piece of code before inserting it into a large
program.  I have one field where the user will insert a 9 character
string.  The first character must be an upper case 'L' while the
remainder must be digits.

Does Perl have any type of toupper function?  I know I can use the
modifier 'i' in my search string to ignore case but I must insert an
upper case 'L' into the database.

Is there a different way to check the last 8 characters and the length
of the string than what I am doing?

Larry Adamiec

Here is the code
####################################
#!/usr/local/bin/perl
use strict;
use warnings;

my $str;

$str = "L12345678";

if ( ($str =~ /^L\d{8}/) && (length($str) == 9) )
{
 print "OK";
}
else
{
 print "Bad";
}
print "\n";


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to