in reply to Regular Expression problem with $variable =~ m/C++/
Your sample could perhaps be better written using a __DATA__ section as:
use strict; #looked variable my $VarString = 'C++'; print "Start...\n"; #search string while (<DATA>) { #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
but the major issue is the old problem of reinventing tricky wheels. CSV, in general, is tricky to parse correctly. You are much better to use something like Text::CSV.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Regular Expression problem with $variable =~ m/C++/
by mtar (Novice) on Jun 12, 2007 at 13:07 UTC | |
by jdtoronto (Prior) on Jun 12, 2007 at 15:48 UTC |