Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Yet another question about reading in data from a file for use in another file

by caelifer (Scribe)
on Dec 14, 2007 at 16:23 UTC ( [id://657073]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://657073]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-18 19:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found