#!/usr/bin/perl -w
use strict;

my $filename = $ARGV[0];
my $word = $ARGV[1];
open my $FILE, '<', $filename or die "No such file: $filename";
my $count = 0;
while ( my $line = <$FILE> ) {
   while ( $line =~ /\b$word\b/g ){
      $count++;
   }
}
close $FILE;
print "The word $word occurred $count times in $filename\n";
