bartrad has asked for the wisdom of the Perl Monks concerning the following question:
Hi all, looking for some help please? I have an output that lists some utilization stats (~0.00). These stats are appear twice (in/out) and are repeated three times per time round the for loop. I'm struggling with figuring out how to store these for each $lag_traffic and then pass them to a hash to store referencing which $lag_traffic they belong to for then onward evaluation later.
What I've got so far pulls out 6 ~0.00's and printing out %lag_load shows there's 6 values against each $lag_traffic, but not the actual values.Totals 1144 12 1116 12 0 0 % Util ~0.00 -- ~0.00 -- -- - +- Totals 1720 18 1529 16 0 0 % Util ~0.00 -- ~0.00 -- -- - +- Totals 1539 16 1425 16 0 0 % Util ~0.00 -- ~0.00 -- -- - +-
foreach $lag_traffic (@lag_id) { my $text = $host->cmd("monitor lag $lag_traffic interval 3 repeat +3 rate | match Totals post-lines 1"); @lag_util = ( $text =~ m/(.\d+\.\d+)/g ); $lag_load{$lag_traffic} = @lag_util; }
$VAR1 = [ '~0.00', '~0.00', '~0.00', '~0.00', '~0.00', '~0.00' ]; $VAR1 = { '200' => 6, '199' => 6 };
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Store and print multiple strings
by roboticus (Chancellor) on Mar 12, 2018 at 13:33 UTC | |
by AnomalousMonk (Archbishop) on Mar 12, 2018 at 14:15 UTC | |
by bartrad (Beadle) on Mar 12, 2018 at 14:16 UTC | |
by AnomalousMonk (Archbishop) on Mar 12, 2018 at 15:02 UTC | |
by roboticus (Chancellor) on Mar 12, 2018 at 15:36 UTC | |
by Anonymous Monk on Mar 12, 2018 at 13:46 UTC | |
by roboticus (Chancellor) on Mar 12, 2018 at 13:55 UTC |
Back to
Seekers of Perl Wisdom