Limo has asked for the wisdom of the Perl Monks concerning the following question:

Ok, I see. I forgot a few basic things here. Again, this code prints duplicate and incrementing values contained in the print statement.Here's the revised code:
use strict; use File::Find; my %slots = (); my @diaglist; my $directory = "/path/to/directory/that/I/want/to/traverse"; find(\&diag, $directory); sub diag { @diaglist = `cat $_ |grep SLOT`; my $device = $_; foreach $rtr_diag(@diaglist) { unless ($rtr_diag =~ m/Clock|Switch|Power|Processor/) { push @{$slots{$device}}, $rtr_diag; } } foreach $device (sort keys %slots) { my $diag_string = join "", @{$slots{$device}}; print "$device:\n"; print "===========================\n"; print "$diag_string\n\n"; } }