in reply to Re: Merging files
in thread Merging files

Thanks! This really did clear up a lot of what I was doing wrong.
Two questions:
1 - Although you commented it I don't understand what
scalar <CUR>;
does.

2 - Instead of using Names as the key you're using two columns? What would you suggest for files with a greater number of columns? Could I just continue on with $cur[3],[4] etc.?
--
lmoran@wtsgSPAM.com
print "\x{263a}"

Replies are listed 'Best First'.
Re: Re: Re: Merging files
by Fletch (Bishop) on Oct 27, 2001 at 04:33 UTC

    As for number one, that's just throwing away the first line. It's just the normal readline diamond operator in void context (technically the scalar is superfluous, but I put it in out of habit). The return value is being discarded rather than being saved anywhere (my $toss = <CUR> would have done just the same thing with a (useless) temporary).

    As for the data structure, it's a hash of hashes. The top level hash (%data) has keys that are the primary key from your data file (the names), and the corresponding value is a hash of key/value pairs from the various data files. Add something like the following to the end of the program and you can see what it looks like:

    ... use Data::Dumper qw( Dumper ); print Dumper( \%data );

    See also perldoc perldsc.

      one last time, thank you! I adjusted the code to meet my actual files and after a few typos I made/repaired it works exactly as expected. Once it was running on my data I could see what the keys were. I am working on your update now and after a quick trip to perldoc I'm set. You rock. thanks!
      --
      lmoran@wtsgSPAM.com
      print "\x{263a}"