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?
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.
Quoting "John W. Krahn" <[EMAIL PROTECTED]>:
[EMAIL PROTECTED] wrote:
Hi all,
Hello,
Can some please advise how to get this to work?
print "matches" if $string =~ m/$pattern/;
Am trying to search for a pattern but the pattern has to be a
variable. Thanks
in advance.
How did this "not work"? What is it not doing that you want it to do? What
warning/error messages did it generate?
You probably have regex meta-characters in $pattern that need to be escaped.
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>