Hi This might sound silly, but what I am trying to do is, I want to loop through the array and if it finds the matching pattern in the text file, print md127. otherwise print sda however I don't want it to print sda for each line it cannot find, I only want to print it once and only if it cannot find the matching pattern. Heres the sample of my code:
#open output
open (IN, $output) || die "Cannot open the.$output.file";
my @lines = <IN>;
close IN;
for (@lines)
{
if ($_=~ /$find/ )
{
#&md127;
print "md127\n";
}
elsif ($_!~ /$find/)
{
print "sda\n";
}
}
any help will be appreciated.