pojif ($msg =~ /!state\s+(.{2})/){ my $search = uc($1); my $result; my @list = <DATA>; for (@list){ chomp; my ($id,$name) = split /\|/,$_; if ($id eq $search){ $result = "State $id = > $name\n"; last; } } # if ($result){ print $result; } else { print "Could not find state $search\n"; } } __DATA__ CA|California ME|Maine NY|New York TX|Texas UT|Utah
In reply to Re: Opening and reading file
by poj
in thread Opening and reading file
by fame
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |