Yep!

except, your regex:

s{([ \\])}{$1 eq '' ? '\ ' : '/'}ge;

has to have a space in the eq comparison:

s{([ \\])}{$1 eq ' ' ? '\ ' : '/'}ge;

Aloha => Beau.

-----Original Message-----
From: Jenda Krynicky [mailto:Jenda@;Krynicky.cz]
Sent: Friday, October 25, 2002 3:33 AM
To: Beau E. Cox; Beginners Perl
Subject: RE: 2 regexs into 1


From:                   "Beau E. Cox" <[EMAIL PROTECTED]>
> Tried #1:
> 
> $_ = 'c:\Program Files\Visual Studio\';

The problem is here! The backslash above escapes the singlequote.
Use an editor with syntax highlighting :-)

> print "$_\n";
> 
> s{([ \\])}{$1 eq '' ? '\ ' : '/'}ge;
> print "$_\n";
> 
> got:
> 
> String found where operator expected at t01.pl line 4, near "s{([
> \\])}{$1 eq '' ? '" Backslash found where operator expected at t01.pl
> line 4, near "' ? '\"
>  (Missing operator before \?)

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to