in reply to Yet another question about reading in data from a file for use in another file

This might be a little Perl-golfish, but it offers you named parameters for further processing
use strict; use Data::Dumper; $/ = ""; my %stats = map { m/(\w+?): .* = \s* (\d+)/xm; $1 => $2; } <DATA>; print Dumper(\%stats); __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
Regards,

- caelifer

  • Comment on Re: Yet another question about reading in data from a file for use in another file
  • Download Code