Hello,
I'm working on a project where I need to split various tag numbers, from a
standard set of prefixes, entered into a form and check the number against a
database.
A sample test code that works, but was wondering if there's a better way to
utilize the regrex of this code:
# @tags similuate the tag numbers entered into a form, multiple numbers
my @tags = qw(K001900 L001234 GP001675);
# @prefixs are a pre-determined set of prefixes used.
my @prefixs = qw(SP 8 L K GP TP MP);
my($tagid,$tnum);
print header('text/html');
while(my $prefix = <@prefixs>) {
foreach $tagid (@tags) {
if ($tagid =~ m!^$prefix!) {
$tagid =~ s!^$prefix!!;
print qq|Prefix: $prefix - Number: $tagid<br>|;
# Results: Prefix: K - Number: 001900
# ...etc
}
}
}
My questions is, is there a better way to separate the prefix from the number ??
Any suggest would be much appreciated.
TIA,
--
Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
Providing Internet Solutions that work!
http://www.thunder-rain.com
Bus Phone: 1(985)902-8484
Cellular: 1(985)320-1191
Fax: 1(985)345-2419
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]