Re: Stuff a hash from two source files
- From: boyd <tbmoore9@xxxxxxxxxxx>
- Date: Thu, 23 Nov 2006 13:19:45 GMT
In article <87hcwq8xx5.fsf@xxxxxxxxxxxxxxxxx>,
Alan_C <mtbr0228AT@xxxxxxxxxxxxxxxx> wrote:
$data{$box}{prior} = $prior; #??This is called a hash of hashes (HOH). The perldoc's perlreftut and
perldsc are good. This line could also be written as
$data{$box}->{prior} = ...
}Same comment as above
# print @box_items;
# while (<BOX>) {
foreach ( @box_items ) {
($box,$group) = split;
$data{$box}{group} = $group; #??
}This is called a hash slice. It is equivalent to
for my $table ( sort by_type( keys %data )) {
my @data = ($table, @{ $data{$table} } {qw/group prior/}); #??
my @data = ($table, $data{$table}->{group}, $data{$table}->{prior} )
print "@data\n";Same comment as first one
}
sub by_type {
$data{$a}{prior} <=> $data{$b}{prior}; #??
}
__DATA__
712480 3
712481 2
712482 1
712480 firstgreen
712481 firstblack
712482 firstblue
Hope that helps.
Boyd
.
- Prev by Date: Re: install Class::DBI::FromForm error
- Next by Date: Re: Free PERL Editor
- Previous by thread: install Class::DBI::FromForm error
- Next by thread: write, print, & Tk::Text
- Index(es):
Relevant Pages
|