read sockets in array using <$socket[i]> in perl -
i want read sockets , "getline" on them.
my @socket1; $socket1[0] = io::socket::inet->new( type => sock_stream, peeraddr => "127.0.0.1", proto => "tcp", peerport => $dbase_param{camera_stream} ) or die "cannot open socket on port " . $dbase_param{camera_stream} . ".\n"; print { $socket1[0] } "\n"; $ligne = <$socket1[0]>; while ( !( $ligne =~ /content-length:/ ) ) { $ligne = <$socket1[0]>; }
it tell me use of uninitialized value $ligne in pattern match (m//)
sec $ligne = <$socket1[0]>;
i don't understand wy
angle brackets used glob()
,
perl -mo=deparse -e '$ligne = <$socket1[0]>;' utilize file::glob (); $ligne = glob($socket1[0]);
so if you're not using plain scalar socket, might more explicit using readline()
,
$ligne = readline($socket1[0]);
arrays perl sockets
No comments:
Post a Comment