if($msg =~ /!info\s+(.{6})/) { my $info = $1; my $database = "list.txt"; open FILE,"$database" or die "Error Opening: $!"; my @results = <FILE>; close FILE; my $var = 0; my $chkvar = 0; foreach my $url(@results) { if($url =~ m/$info\|(.*)\|(.*)/) { if($var == 0) { $var = 1; sendmsg($irc_socket, "PRIVMSG $channel 	 +219;4,1[␃0,1BANK␃4,1]␃9,1 $1"); goto finish; } }else{ $chkvar = 1; } } if($chkvar == 1) { sendmsg($irc_socket, "PRIVMSG $channel ␃4,1[ +␃0,1BANK␃4,1]␃7,1 Could not retreive bank"); } finish: }
i have this piece of code from an irc bot and what it does it read the first 6 digits from the file when someone types !bank 123456 and display whats after it.. example of text file:
518767|CAIXA ECONOMICA FEDERAL|LA BRA BRASILIA |BRAZIL|
Now I had a question, since im no guru at all in perl. How oculd I change this function to say like the command be !state and the person says: !state NY
it reads from the file and it returns the results as State NY = > New York.
ive tried the same concept as above and made the abbreviations of the states and text file looking like: NY|New York but did not have any sucesss.. could someone point me in the right direction?
Update: Thanks
In reply to Opening and reading file by fame
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |