Thanksmy $word="test"; while(<DATA>) { if(/\b($word)\b/) { @arr = split(/\s+/,$_); $col = ""; $i=0; foreach $k (@arr) { if($k eq "$word") { $col.=($i+1)."\t"; } $i++; } print "The word repeated in Line ".$.." and in column ".$col."\n"; } } __DATA__ This is a test from tester okay nothing message test center test test in proress ... test one test two
In reply to Can anyone simplify this code by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |