On 08/11/2006 11:50 PM, [EMAIL PROTECTED] wrote:
Hi John,

Thanks for a very quick response John.

It gives the error as below:

Trailing \ in regex m/D:\STUDY\PERL\MYFTP\/ at D:\Study\Perl\MyFtp\Ftp1.pl line
109.

($base,$path,$type) = fileparse($ARGV[0]);
$pattern=$path;
print "matches" if $string =~ m/$pattern/;

I print $pattern and it is D:\STUDY\PERL\MYFTP\. You are probably that there are some meta-characters, \ :, that I need to escape, but how do I escape them if they are variables?


Read "perldoc -f quotemeta" and use \Q and \E around your variable.

Also, how do I do a non-case sensitive match. At the moment, am using uc() to upper case both the string and the pattern that I am searching for.



Read "perldoc perlop" (the m/PATTERN section) and use the /i option to m//.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to