use strict; use warnings; use Data::Dumper; local $/; my %data = (map{unpack 'x19A5x25A*', $_}<DATA>); print Dumper(\%data); __DATA__ Data Collected for SA120:Prct Dirty Cache Pages = 0 Data Collected for SA121:Prct Dirty Cache Pages = 1 Data Collected for SA122:Prct Dirty Cache Pages = 0 Data Collected for SA220:Prct Dirty Cache Pages = 0 Data Collected for SA221:Prct Dirty Cache Pages = 0 Data Collected for SA222:Prct Dirty Cache Pages = 17
$VAR1 = { ' SA220' => ' 0', ' SA221' => ' 0', ' SA122' => ' 0', ' SA222' => ' 17', ' SA121' => ' 1', ' SA120' => ' 0' };
/.+(SA\d{3}).+?(\d+)(?{$data{$1}=$2})/ for <DATA>
In reply to Re: Yet another question about reading in data from a file for use in another file
by poolpi
in thread Yet another question about reading in data from a file for use in another file
by wruehl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |