open FILE , "routers.txt" or die $!; while () { print "$_\n"; } print " Enter name"; $s=<>; chomp($s); while(my $line = ) { #if(/\b$s\b/){ if(/\b$s\b/){ my $IP = $line =~ /\d+\.\d+\.\d+\.\d+/; push(@IPS, $IP); } } #print "hei"; print $IP;