in reply to Re: i dont like the way my code looks but work
in thread i dont like the way my code looks but work
use strict; use diagnostics; sub init { my %total; while (<DATA>) { #my %total; #why doesn't this work?????? 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"; } return \%total; } sub do_something { my $do_it = shift; while (<>) { chomp; my $item = $_; for (keys %{$do_it}) { print "$_ ===> $$do_it{$_}\n" if $_ eq "$item"; } } } do_something(init());
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: i dont like the way my code looks but work
by moritz (Cardinal) on Jan 27, 2008 at 19:03 UTC |