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
plz help me192.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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: problem in printing the result in the out put file
by Eily (Monsignor) on Feb 28, 2017 at 16:22 UTC | |
by johngg (Canon) on Feb 28, 2017 at 19:12 UTC | |
by Eily (Monsignor) on Feb 28, 2017 at 19:46 UTC | |
Re: problem in printing the result in the out put file
by toolic (Bishop) on Feb 28, 2017 at 16:18 UTC | |
Re: problem in printing the result in the out put file
by marto (Cardinal) on Feb 28, 2017 at 16:35 UTC | |
Re: problem in printing the result in the out put file
by thanos1983 (Parson) on Feb 28, 2017 at 16:30 UTC | |
Re: problem in printing the result in the out put file
by RonW (Parson) on Mar 02, 2017 at 21:43 UTC |
Back to
Seekers of Perl Wisdom