in reply to Re^4: Combining Records From Multiple Files based on Common Key Values
in thread Combining Records From Multiple Files based on Common Key Values

Hmm, we love changing requirements...in that case you'd need to first build a hash which contains the server names in the key by going through all the files (caching their content if their not large enough for this to cause memory problems), and then iterate over that list of servers (see perldoc -f keys on how to do that) in the while loop, inserting the value found in the respective file or a 0, e.g.

push (@{$result{$server}},$cpua || 0)

All dogma is stupid.

Replies are listed 'Best First'.
Re^6: Combining Records From Multiple Files based on Common Key Values
by country1 (Acolyte) on Jul 17, 2007 at 18:28 UTC
    tirwhan, Would it be too much to ask for you to show me how I would incorporate into your original code? I'm sorry I typically do my applications in either shell scripts (with awk or sed) or SAS. This application must be done in perl, which I am a little less familiar with.

      I've told you how it can be done, esper and Limbic~Region have suggested alternative approaches. Why don't you try composing your own, working solution from that (read some of the documentation I've pointed out and maybe some more basic Perl documentation perldoc perltoc is a good place to start) and this problem should be easy to solve. If something isn't working or you don't understand what certain parts of the code do then ask specific questions about that (preferably posting what you've tried) and I'm sure you will get help. PM is a place where we try to aid each other's understanding of Perl, not have someone do the work for you. If you want that, hire a Perl programmer.


      All dogma is stupid.