Leser: 29
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#!/usr/bin/perl -w use IO::Socket; my (@anruf, $line, $i); $remote = IO::Socket::INET->new( Proto => "tcp", PeerAddr => "192.168.2.1", PeerPort => "1012", ) or die "cannot connect to daytime port at localhost"; while ( <$remote> ) { $line = <$remote>; @anruf = split(/;/, $line); if ($anruf[1] =~/RING/) { print "Ankommend"; } else { print "no"; } }; close $remote;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#!/usr/bin/perl -w use strict; use warnings; my $remote = <<__INPUT__; 08.03.10 20:37:35;RING ;0;017100000;3100000;SIP0; 08.03.10 20:37:40;DISCONNECT ;0;0; 09.03.10 07:40:09;RING;0;017100000;3100000;SIP0; 09.03.10 07:40:14;CONNECT;0;0;017100000; 09.03.10 07:40:25;DISCONNECT;0;6; 09.03.10 07:41:05;CALL;0;0;3100000;017100000;SIP0; 09.03.10 07:41:22;DISCONNECT;0;0; 09.03.10 07:41:37;CALL;0;0;3100000;017100000;SIP0; 09.03.10 07:41:46;CONNECT;0;0;017100000; 09.03.10 07:41:54;DISCONNECT;0;7; __INPUT__ foreach (split /\n/,$remote) { my @anruf = split (/;/,$_); print "$anruf[0] "; if ($anruf[1] =~/RING/) { print "Ankommend\n"; } else { print "no\n"; } }