Re: Trying to match window's path

2008-12-19 Thread Chas. Owens
On Thu, Dec 18, 2008 at 20:47, Rob Dixon wrote: snip > > First of all it is best to use single quotes when defining strings that > contain > backslashes. > > my $s1 = 'c:\log\s1.log'; > > then you don't need to escape them (unless one appears as the final character > in > the string, when you s

Re: Trying to match window's path

2008-12-18 Thread Rob Dixon
Gu, Han wrote: > > Still very noob when it comes to perl. Just have a quick question. I am > trying to match a string that is window's path > > Sample, > > $s1 = "c:\\log\s1.log"; > > $s2 = $s1; > > If ($s1 =~ m/$s2/i) { > print "matched\n"; > } > > It just wouldn't match. I can pu

RE: Trying to match window's path

2008-12-18 Thread Gu, Han
Thx Shawn. It's working. -Original Message- From: Mr. Shawn H. Corey [mailto:shawnhco...@magma.ca] Sent: Thursday, December 18, 2008 11:56 AM To: Gu, Han Cc: 'beginners@perl.org' Subject: RE: Trying to match window's path On Thu, 2008-12-18 at 11:40 -0500, Gu,

RE: Trying to match window's path

2008-12-18 Thread Mr. Shawn H. Corey
On Thu, 2008-12-18 at 11:40 -0500, Gu, Han wrote: > Another question since I hit another snag on this, hopefully it's the last =) > > Sample --> > > $s2 = "c:\ise\conf\ise_eif_lvc.config"; You should always escape backslashes in literal strings: #!/usr/bin/perl use strict; use warnings; my $s

RE: Trying to match window's path

2008-12-18 Thread Gu, Han
I thought quotemeta does just that. Again, many thx in advance. Han -Original Message- From: Mr. Shawn H. Corey [mailto:shawnhco...@magma.ca] Sent: Thursday, December 18, 2008 10:51 AM To: Gu, Han Cc: 'beginners@perl.org' Subject: Re: Trying to match window's path On Thu, 20

RE: Trying to match window's path

2008-12-18 Thread Gu, Han
Thx again -Original Message- From: Mr. Shawn H. Corey [mailto:shawnhco...@magma.ca] Sent: Thursday, December 18, 2008 10:53 AM To: Gu, Han Cc: 'beginners@perl.org' Subject: Re: Trying to match window's path On Thu, 2008-12-18 at 10:50 -0500, Mr. Shawn H. Corey wrote: >

Re: Trying to match window's path

2008-12-18 Thread Mr. Shawn H. Corey
On Thu, 2008-12-18 at 10:50 -0500, Mr. Shawn H. Corey wrote: > On Thu, 2008-12-18 at 10:42 -0500, Gu, Han wrote: > > Hi, > > Still very noob when it comes to perl. Just have a quick question. I am > > trying to match a string that is window's path > > > > Sample, > > > > $s1 = "c:\\log\s1.log";

RE: Trying to match window's path

2008-12-18 Thread Gu, Han
Great, ty so much -Original Message- From: Mr. Shawn H. Corey [mailto:shawnhco...@magma.ca] Sent: Thursday, December 18, 2008 10:51 AM To: Gu, Han Cc: 'beginners@perl.org' Subject: Re: Trying to match window's path On Thu, 2008-12-18 at 10:42 -0500, Gu, Han wrote: > Hi,

Re: Trying to match window's path

2008-12-18 Thread Mr. Shawn H. Corey
On Thu, 2008-12-18 at 10:42 -0500, Gu, Han wrote: > Hi, > Still very noob when it comes to perl. Just have a quick question. I am > trying to match a string that is window's path > > Sample, > > $s1 = "c:\\log\s1.log"; > > $s2 = $s1; > > If ($s1 =~ m/$s2/i) { > print "matched\n"; >

Trying to match window's path

2008-12-18 Thread Gu, Han
Hi, Still very noob when it comes to perl. Just have a quick question. I am trying to match a string that is window's path Sample, $s1 = "c:\\log\s1.log"; $s2 = $s1; If ($s1 =~ m/$s2/i) { print "matched\n"; } It just wouldn't match. I can put the actual string into m//i, which wou