Hey Gunnar, and list, -------------------snip---------------------------------------- print "\n"; my %HoA; for ( `dir /b/s` ) { push @{ $HoA{$1} }, $2 if /(.+)\\(\w+)\.\d+\.\w+$/; }
for my $dir ( sort keys %HoA ) { print join ( "\n", $dir ), "\n\n"; my @basenames = @{ $HoA{$dir} }; my %count; for my $frames ( @basenames ) { $count{$frames} += 1; } for ( sort keys %count ) { printf "%30s\t%04d\n", $_, $count{$_}; } print "\n"; } -------------------snip---------------------------------------- gives me: C:\scripts\dir\dir\dir basename 0010 basename 0006 basename 0005 C:\scripts\dir\dir\dir\sub_directory basename 0010 C:\scripts\dir\dir\dir\sub_directory\deeper_sub basename 0004 C:\scripts\dir\dir\dir\sub_directory\deeper_sub even_deeper_sub basename 0011 This is what I was shooting for, file basenames and counts. Thanks! I've been reading 'perlreftut', 'perlrefdsc' and the rest over the weekend and today. I've been playing around with everything there. It's a lot, but I'm plowing through. If I wanted to add more fields to my output, which construct would I use to create more fields; something like the following? basename count extension size ...maybe 'HoH', or just expand on the 'HoA? --- Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote: > Gunnar Hjalmarsson wrote: > > > > for my $dir ( sort keys %HoA ) { > > print "$dir\n"; > > my @basenames = @{ $HoA{$dir} }; > > my %count; > > for my $frames ( @basenames ) { > > $count{$frames} += 1; > > } > > for ( sort keys %count ) { > > printf "%30s\t%04d\n", $_, $count{$_}; > > } > > } > > Or with less typing: > > for ( sort keys %HoA ) { > print "$_\n"; > my %bn; > %bn = map { $_, ++$bn{$_} } @{ $HoA{$_} }; > printf "%30s\t%04d\n", $_, $bn{$_} for sort > keys %bn; > } > > ;-) > > -- > Gunnar Hjalmarsson > Email: http://www.gunnar.cc/cgi-bin/contact.pl > > -- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > <http://learn.perl.org/> > <http://learn.perl.org/first-response> > > > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>