!/usr/local/bin/perl $string="a student name is sa\nravanan. saravanan is studying 3rd stan +dard.i am go with sara\nvanan"; $count = 0; $string =~s/\n//g; #removing \n print "$string\n"; @array = split(" ", $string); #making the string into individual +list elements foreach $element(@array){ if($element=~/\bsaravanan\b/){ $count++; } } print "found: $count matches.\n";
In reply to Re^3: reading file
by biohisham
in thread reading file
by saranperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |