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..