Manuel Sanguino wrote: > this is my script > > #!/usr/bin/perl -w > > > use lib "/my/perl_directory/lib/perl5/site_perl/5.8.3/"; > use IO::Socket::INET6; > $host="150.187.25.206"; > my $dat1; > my @arreglo; > my @arreglo2; > my $dat2; > my $dat3; > my $dato; > my $count; > my $volt1; > $remote = IO::Socket::INET6->new( Proto => "tcp", > PeerAddr =>$host, > PeerPort => 8000, > ); > unless ($remote) { die "cannot connect to $host" } > $remote->autoflush(1); > while ( <$remote> ) > { > > "do it something here" > > > $dat1=$_; > chomp($dat1); > push(@arreglo,$dat1); > print "@arreglo \n";
The above print statement is your problem, not the socket. When Perl prints an array in the above fashion it separates the elements with a single space (by default). perldoc -q "weird spaces" If you want the elements to have a different delimiter you need to provide the code yourself, for instance, print join ', ', @arreglo; perldoc -f join perldoc -f map > } > close $remote; > > > i try to receive a data with a socket ... socket receive data in > follow format > > A111B222C333 ...H888 a char per time .. > but when i saved in a array... the data is separated by white space > ...and no separated by "," .... I try to do separate in the follow > form but I can"t ... > (A111,B222,C333,D444...) > > plz help me thz > > excuse my english > If you are ever curious about what exactly a data structure looks like you can use Data::Dumper (standard) to display it, use Data::Dumper; print Dumper([EMAIL PROTECTED]); For instance. HTH, http://danconia.orgp -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>