#!/usr/bin/perl use strict; use warnings; if ($#ARGV != 1) { print "Error: Usage- script.pl filename keyword(to be searched)\neg:search.pl config_file XYZ\n"; exit; } our $file=$ARGV[0]; our $key=$ARGV[1]; my $count = 0; if (-e "$file") { open (DATA,$file); chomp($key); # Search for the key pattern in the file information. while (defined (my $line = )) { if ($line =~ /\b\Q$key\E\b/i) { #next; print "$line\n"; $count++; } } if($count == 0) { print "Keyword not found\n Search Completed\n"; } close (DATA); } else { print "Error: file does'nt exist\n"; exit; }