in reply to Hash of anonymous hashes --- Oh my

sweetblood,
Try the following untested code:
#!/usr/bin/perl -w use strict; my %rets; open(RL, "/home/myftplog") or die "Unable to open input file : $!" my @fields = qw ( FNAME RECLEN LIAISON_EMAIL LIAISON_FNAME LIAISON_LNAME LIAISON_AREACODE LIAISON_PHONE LIAISON2_EMAIL LIAISON2_FNAME LIAISON2_LNAME LIAISON2_PHONE RETNAME RETAILER_EMAIL LIAISON2_AREACODE RETAILER2_EMAIL FTPCHECK RETID SCRIPT_NAME EXECFLAG FREQUENCY FILE_NUMBER ); while (<RL>) { chomp; next if /^$/; my @vals = split /:/; $vals[0] ||= '_001'; my %temp_hash; @temp_hash{ @fields } = @vals; $hash{ $vals[0] } = \%temp_hash; } print $_, $/ for keys %rets;
Cheers - L~R

Replies are listed 'Best First'.
Re: Re: Hash of anonymous hashes --- Oh my
by allolex (Curate) on Nov 17, 2003 at 18:57 UTC
      allolex,
      I would also suggest to sweetblood that he might consider leaving the values in an an AoA,

      I didn't suggest an AoA, but rather, a HoH as requested. I just use a hash slice to make the code a lot more concise.

      Cheers - L~R