hallikpapa has asked for the wisdom of the Perl Monks concerning the following question:
I would like to be able to search through the hash, looking for conditionals. For example, on the customer tab in the workbook, if column 1 has a value in it, I want to iterate through the entire row cell by cell so I can write the data a certain way (new customer). If there is a value in that column, I will write that one value and move onto the next sheet in the workbook. What's a good way to do this, or a better way to store my data in a hash and produce good results? I was starting off like this, but it sorts on the first character, as expected, but was thinking it would be quicker if I had a hash of hashes of sorts, and sorted each level of the hash.$excel{$tab."-".$row."-".$col} = $cell->{Val};
foreach my $key (sort {lc($a) cmp lc($b)} keys %excel) { my($tab,$row,$col) = split(/-/, $key); if (($tab eq "Customers") && ($col eq "1") { }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Searching through a hash
by ikegami (Patriarch) on Nov 05, 2007 at 20:03 UTC | |
by hallikpapa (Scribe) on Nov 05, 2007 at 22:25 UTC | |
by ikegami (Patriarch) on Nov 05, 2007 at 22:32 UTC |