Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

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

by davies (Prior)
on Dec 14, 2007 at 16:03 UTC ( [id://657066]=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

I'm sure there are better ways of doing the 'split', but the following works for me:
use strict; use warnings; use diagnostics; my %forchecking; while (<DATA>) { chomp; my @sFields = split /\s+/; $forchecking{substr($sFields[3],0,5)} = $sFields[8]; } __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,

John Davies

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (8)
As of 2024-03-29 14:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found