in reply to File Searching
Update: Anno makes it better for anticipating unexpected input. I did solely by the fact of the sample input. I know about \s* and limit in split.my $entries; while (<DATA>) { chomp; my($ip, $text) = split /\s+\|\s+/; $entries{$ip} = $text; } print $entries{"192.168.0.1"}; # some text __DATA__ 192.168.0.1 | some text 192.168.0.2 | another text
Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: File Searching
by Anno (Deacon) on Sep 13, 2007 at 18:22 UTC | |
|
Re^2: File Searching
by mattwortho (Acolyte) on Sep 13, 2007 at 15:43 UTC |