I guess I am running into all sorts of problem with this program. Can any body please explain me the compilation error...
syntax error at ./a.pl line 11, near "#if($a =~ /((?:" (Might be a runaway multi-line ?? string starting on line 8) Execution of ./a.pl aborted due to compilation errors.
1 #!/usr/bin/perl 2 3 use warnings; 4 use strict; 5 6 7 my $a="1: 192.168.0.180:32866 - 192.168.0.183:143 (a2b) 14< (complete)"; 8 my $ip = (?:\d{1,3}\.){3}\.\d{1,3}; 9 10 print "a = $a\n"; 11 #if($a =~ /((?:\d{1,3}\.){3}\d{1,3})/) { 12 if($a =~ /((?:\d{1,3}\.){3}\d{1,3})/) { 13 print "ip = $1\n"; 14 } else { 15 print "There wasnt any ip.....:-||| \n"; 16 } 17
On commenting line number 11 it gives this error. When this same line is deleted it compiles successfully.
Thanks and Regards, Manish
On 05/17/2005 07:54 PM, Ing. Branislav Gerzo wrote:
Manish Sapariya [MS], on Tuesday, May 17, 2005 at 17:38 (+0530) has on mind:
MS> echo "1: 192.168.0.180:32866 - 192.168.0.183:143 (a2b) MS> 17> 14< (complete)" | perl -lane 'print$_;if($_ =~ MS> /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}):(\d{1,5}) - MS> (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}):(\d{1,5})/) {print "Source IP MS> = $1, Source Port = $2, Destinatin IP = $3, Destination Port = MS> $4\n"}'
some ideas how to write ip: ((?:\d{1,3}\.){3}\.\d{1,3}) (\d{1,3}(?:\.\d{1,3}){3})
good idea is store regexp into variable and use that variable in regexp. $ip = ((?:\d{1,3}\.){3}\.\d{1,3}) /$ip:(\d{1,3})\s*-\s*$ip:(\d{1,3})/ of course you can do that with port too.
--
How do you protect mail on web? I use http://www.2pu.net
[A revolving lithic conglomerate accrues no lichen.]
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>