Beefy Boxes and Bandwidth Generously Provided by pair Networks kudra
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Opening and reading file

by poj (Curate)
on Jan 15, 2012 at 21:21 UTC ( #948020=note: print w/ replies, xml ) Need Help??


in reply to Opening and reading file

if ($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
poj


Comment on Re: Opening and reading file
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://948020]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2014-04-18 01:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (460 votes), past polls