Hi monks. I have a question about function. I code some script using perl often. Below script, script open text file that include many words 'test'. but I want to print only one when script meet 'test' at first. so I always use $flag. however that script looks bad and uncomfortable. Can you recommand new functions? or tips? about that issue??
open TEST,"@ARGV[0]";
$flag ="ON"
while(<TEST>){
if(/test/ and $flag eq "ON"){print "start";$flag ="OFF"}}
close TEST