http://qs1969.pair.com?node_id=1183156

hegaa has asked for the wisdom of the Perl Monks concerning the following question:

hi I'm using this code

#!/usr/bin/perl use IO::Socket; my $ip = $ARGV[0]; my $port=$ARGV[1]; open DAT,$in_file2; my @ip=<DAT>; close DAT; chomp(@ip); foreach my $ip(@ip) { $host = IO::Socket::INET->new( PeerAddr=>$ip, PeerPort=>$port, proto =>'tcp', Timeout=> 0.01, ) and open(OUT, ">>port.txt"); print OUT "\n$ip:$port\n"; close(OUT); }

it's printing the result like this

192.168.1.2 :22 192.168.1.2 :22 192.168.1.2 :22 192.168.1.2 :22

but i want it to print it like this

192.168.1.2:22 192.168.1.2:22 192.168.1.2:22 192.168.1.2:22 192.168.1.2:22 192.168.1.2:22 192.168.1.2:22 192.168.1.2:22 192.168.1.2:22 192.168.1.2:22 192.168.1.2:22 192.168.1.2:22
plz help me