$line = "The most hello great hello great important";
$count = $count -1 ;
print "The no of occurences of hello in line is $count";
The no of occurences of hello in line is 2
Here is split function is used to split line based on the word hello.And the no of split words will be 1 more than the occurence of the word.So we need to subtract 1.