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