http://www.perlmonks.org?node_id=1210710

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 };