use strict; use File::Find; 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"; } }
In reply to Nesting/Loop/Print problem by Limo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |