Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: File Parsing Question

by hippo (Bishop)
on Apr 06, 2021 at 15:31 UTC ( [id://11130903]=note: print w/replies, xml ) Need Help??


in reply to File Parsing Question

To do it in one pass you can use this algorithm:

  1. Read one line
  2. If it is a host line, extract the hostname and store it in a scalar variable. Go to 1.
  3. If it is not an nfs line, go to 1
  4. Extract the share from the line.
  5. If there is no entry in your hash for that share, create one which is an arrayref with the current host as its only member. Go to 1.
  6. Append the current host to the existing arrayref in the hash value for the current share. Go to 1.

🦛

Replies are listed 'Best First'.
Re^2: File Parsing Question
by neptuna (Acolyte) on Apr 06, 2021 at 18:25 UTC

    Thanks, I thought about going this route and working on that now..

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2024-04-26 03:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found