develooper Front page | perl.beginners | Postings from May 2007

missing something from regex ...

Thread Next
From:
Gregory Machin
Date:
May 16, 2007 03:55
Subject:
missing something from regex ...
Message ID:
30200a940705160355x2bcd5b4ha7b767410edf87d7@mail.gmail.com
Hi i have the following string
I need to break down into usable data ...

CLIENT_LIST,tsc-odi.vpn.ct-net.org,165.146.60.29:11134,10.1.0.46,1959761,218729,Wed
May 16 11:24:37 2007,1179307477

and I dont want "Wed May 16 11:24:37 2007" cause the number at the end
is the same thing ..

this is the beginning of my code ...

$row = "CLIENT_LIST,tsc-odi.vpn.ct-net.org,165.146.60.29:11134,10.1.0.46,1959761,218729,Wed
May 16 11:24:37 2007,1179307477"
$row = ~/(\w+)\,(\w+)\,(\d+\.\d+\.\d+\.\d+\:\d+)\,(\d+\.\d+\.\d+\.\d+)\,(\d+)\,(\d+)\,\,(\d+)/
print "info $1 \n";
print "hostname $2 \n";
print "pubip $3 \n";
print "wanip $4 \n";
print "recieved $5 \n";
print "sent $6 \n";
print "time $7 \n";


and I'm getting the following error ..

[root@server ~]# ./vpninfo.pl
./vpninfo.pl: line 1: =: command not found
./vpninfo.pl: line 2: syntax error near unexpected token `('
./vpninfo.pl: line 2: `$row =
~/(\w+)\,(\w+)\,(\d+\.\d+\.\d+\.\d+\:\d+)\,(\d+\.\d+\.\d+\.\d+)\,(\d+)\,(\d+)\,\,(\d+)/'
[root@server ~]#


.... what have I missed ...

Many thanks





-- 
Gregory Machin
gregory.machin@gmail.com
www.linuxpro.co.za

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About