#! c:/perl/bin/perl.exe use strict; my ($Rec2, $pc_name); my ($hash,$key); open (LST,"c:/showtech".$ARGV[0].".txt") || die "$!\n"; while() { $key = $1, next if (/interface port-channel (\d+)$/); $hash->{$key}->{$1} = $2 if (/switchport description To (\w+) ([\d\.]+)/); } close LST; open (LST,"c:/showtech".$ARGV[0].".txt") || die "$!\n"; while() { $pc_name = $1, next if (/(port-channel \d+)$/); $Rec2->{$pc_name}->{$1} = $2 if (m|(fc\d+/\d+)\s+\[(\w+)\]|); } for my $data (keys %{$Rec2}) { print "\n$data \n"; } for my $data (keys %{$hash}) { print "$data\n"; }