use strict; #looked variable my $VarString = 'C++'; print "Start...\n"; #search string while () { #check with the matching expression next unless m/$VarString/; chomp; print "I have found the string $VarString at line $.\n"; } print "Stop\n"; __DATA__ VISUAL BASIC,PERL,PASCAL C#,C,C++ ASSEMBLER,PHP,JAVA HTML,XML,JAVA ####