#!perl use strict; open FH_SECOND,"<",$ARGV[0] or die $!; my @setting = ('Port Speed','Duplex Setting','Switchport Access Mode','Spanning Tree Mode'); my $line1 = ; if ($line1 =~ /description xxxxxxxxx/){ while (){ my $msg = 'Gigabit '.shift @setting; if(/speed 1000|duplex full|switchport mode access|spanning-tree portfast/){ print $msg." is OK!!!\n"; } else { print $msg." is WRONG!!!\n"; } } } else { print "The Configuration File $ARGV[0] is NOT the RIGHT FILE \n"; } close(FH_SECOND); # test file #description xxxxxxxxx #speed 1000 #duplex full #switchport mode access #spanning-tree portfast