Hi

The "8.1.8" =~ /[\d $versao \s]/ will always return true because the square 
parenthesis ([]) matches the string against one of the chars inside. In this 
case the \d (digit) matches because you have a digit inside.

In your code you wrote  "8.1.8" =~ /$version/. This takes the $version a treat 
it as a regular expression.
I don't think that this is what you want. You actually want something like 
$version =~ /8\.1\.8/.

Yaron Kahanovitch
----- Original Message -----
From: "Rodrigo Tavares" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Sent: Wednesday, April 11, 2007 4:30:58 PM (GMT+0200) Auto-Detected
Subject: Using regular expressions with delimitaters

Hello,

I need to use the delimiter " " , (one blank space).
I read perdoc, i try to use this : 

if ( "8.1.8" =~ /[\d $versao \s]/)

But the expression is always true.
Where is the error ?

my code :

#!/usr/bin/perl
$version=`/usr/local/pgsql/bin/pg_ctl --version`;
print $version;

if ( "8.1.8" =~ /$version/)
 {
  print "$version\n";
 }
else
 {
  print "Wrong version !\n";
 }

Output, about program:

pg_ctl (PostgreSQL) 8.1.8
Wrong version

Best regards,

Rodrigo Faria

__________________________________________________
Fale com seus amigos  de graça com o novo Yahoo! Messenger 
http://br.messenger.yahoo.com/ 

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




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


Reply via email to