Hi Ing,
example u gave compiles well and after
diffing your and my code it shows that

the single quotes in my $ip = '((?:\d{1,3}\.){3}\d{1,3})'

made the code compile.

Thanks for the help.
Regards,
Manish



On 05/18/2005 02:49 PM, Ing. Branislav Gerzo wrote:
Manish Sapariya [MS], on Wednesday, May 18, 2005 at 11:12 (+0530)
typed:

MS> Thats really neat way of writing the expression I was looking for.
MS> But somehow I couldnt get the following compiled. It says

heh, ok, this will work:

#!/usr/bin/perl
use strict;
use warnings;

my $a="1: 192.168.0.180:32866 - 192.168.0.183:143 (a2b) 14<  (complete)";
my $ip = '((?:\d{1,3}\.){3}\d{1,3})';
print "ip = $1\n--\n" if ( $a =~ /$ip/ );
if ( my ($myip) = $a =~ $ip ) { print "ip = $myip" }
__END__

1. I think you should use "use strict;" and after that "use warnings;".
2. regexp operator is =~
3. you dont need parenthesis around $ip

--

How do you protect mail on web? I use http://www.2pu.net

["Bother" said Pooh as he found the hook in the fish he had swallowed]



-- 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