#!/usr/bin/perl $keyword = shift @ARGV; $line = 0; while(<>) { $line++; chop; #Add the word boundary to the search print "[$line] ", $_ , "\n" if m/\b$keyword\b/; }