#! /usr/bin/perl -w use strict; # read the file open FH , "<" , "/etc/mtab" or die "can't open file"; my @line_list = ; close FH; # count the number of "/home" "nfs" lines my $match_count = grep { m/ \/home nfs / } @line_list; if ($match_count == 0) { print "Do something\n"; } else { print "DO something different\n"; }