Question on Perl regular expression
Posted on 2006-03-22
I'm trying to do is - The program will prompt for enter string and user will enter string. After that it will compare the inputed string with the contain in 'str.tbl'.
'str.tbl' contains list of charather with numbers. The program will exit if the inputed chrather/numbers matches with the contain in 'str.tbl'.
The problem i'm having is this coding does not recognise charathers... it only recognise number...
The coding can only recognise "890211" and "42893".
Any suggestion on the right regular expression to make all contain in 'str.tbl' to be recognised by this program?
$str = "";
$file = "strfile.bat";
print 'Enter String : ';
($str = <STDIN>);
open(F, "str.tbl") || die "can't open str.tbl $!";
if((/^$str/) && ($str != ""))
print "Creating String\n";
open(SRC, ">$file") || die "Unable to open strfile.bat: ($!)\n";
print SRC "set string=$str\n";