convenientstore has asked for the wisdom of the Perl Monks concerning the following question:
use strict; my %total; while (<DATA>) { next if /^#/; next if /^$/; next if ! /(server[1-4])\s+(proc[A-Z]+)\s+(proc\.[0-9]+)\s+[0-9]+\s+ +([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:?[0-9]{4}?)\s+.+$/; $total{join ("\@", $3,$1)} = "$4"; } my @matches = (); while (<>) { chomp; my $item = $_; #@matches = grep {$_ eq $item} (keys %total); for (keys %total) { push @matches, $_ if $_ eq "$item"; } } for (@matches) { print "$_ ===> $total{$_}\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: i dont like the way my code looks but work
by moritz (Cardinal) on Jan 25, 2008 at 08:58 UTC | |
by alexm (Chaplain) on Jan 27, 2008 at 20:21 UTC | |
by convenientstore (Pilgrim) on Jan 27, 2008 at 22:15 UTC | |
|
Re: i dont like the way my code looks but work
by roboticus (Chancellor) on Jan 25, 2008 at 11:53 UTC | |
by convenientstore (Pilgrim) on Jan 25, 2008 at 15:18 UTC | |
by moritz (Cardinal) on Jan 27, 2008 at 19:03 UTC | |
|
Re: i dont like the way my code looks but work
by poolpi (Hermit) on Jan 25, 2008 at 09:12 UTC | |
|
Re: i dont like the way my code looks but work
by dragonchild (Archbishop) on Jan 25, 2008 at 14:47 UTC |