my $machine = shift @_; foreach my $line (sort @::Lines){ if($line =~ m/\Q$machine\E\b/){ print "MACHINE = $machine \n"; } }