Here it goes much proper way to view: :)
open(OUTFILE, ">", "check_result.txt") or die ("unable to write output +: $!"); my @url = ('www.yahoo.com', 'www.google.com' ); #for check Ping & c +heck TCP #check Ping print OUTFILE "*Ping Result*\n"; use Net::Ping; $p = Net::Ping->new("syn"); if ($p->ping($url2[0])) { print OUTFILE "$url2[0] is alive. \n"; } else { print OUTFILE "$url2[0] is not alive. \n"; } if ($p->ping($url2[1])) { print OUTFILE "$url2[1] is alive. \n\n"; } else { print OUTFILE "$url2[1] is not alive. \n\n"; } #check TCP Result use strict; use Socket; use Time::HiRes qw( gettimeofday ); use Net::hostent; print OUTFILE "*TCP Result*\n"; my $timeout = 3; my $hostname = ($url2[0]); my $hostname1 = ($url2[1]); my $portnumber = '80'; my $portnumber1 = '80'; my $host = shift || $hostname; my $host1 = shift || $hostname1; my $port = shift || $portnumber; my $port1 = shift || $portnumber1; my $proto = getprotobyname('tcp'); my $iaddr = inet_aton($host); my $iaddr1 = inet_aton($host1); my $paddr = sockaddr_in($port, $iaddr); my $paddr1 = sockaddr_in($port1, $iaddr1); socket(SOCKET, PF_INET, SOCK_STREAM, $proto) || die "socket: $!"; +#for casino.sbobet.com eval { local $SIG{ALRM} = sub { die "timeout" }; alarm($timeout); connect(SOCKET, $paddr) || error(); alarm(0); }; if ($^P) { close SOCKET || die "close: $!"; print OUTFILE "$hostname is NOT listening on tcp port $portnumber.\n +"; } else { close SOCKET || die "close: $!"; print OUTFILE "$hostname is listening on tcp port $portnumber."; my ($t02, $t12, $startTime2); $startTime2 = gettimeofday(); connect(SOCK, $paddr); $t02 = gettimeofday() - $startTime2; close (SOCK); $t02 = gettimeofday() - $startTime2, printf OUTFILE (" avg:%.8f", $t02); print OUTFILE ("ms\n"); } socket(SOCKET, PF_INET, SOCK_STREAM, $proto) || die "socket: $!"; #f +or casino1.sbobet.com eval { local $SIG{ALRM} = sub { die "timeout" }; alarm($timeout); connect(SOCKET, $paddr1) || error(); alarm(0); }; if ($ARGV) { close SOCKET || die "close: $!"; print OUTFILE "$hostname1 is NOT listening on tcp port $portnumber1. +\n"; } else { close SOCKET || die "close: $!"; print OUTFILE "$hostname1 is listening on tcp port $portnumber1."; my ($t02, $t12, $startTime2); $startTime2 = gettimeofday(); connect(SOCK, $paddr1); $t02 = gettimeofday() - $startTime2; close (SOCK); $t02 = gettimeofday() - $startTime2, printf OUTFILE (" avg:%.8f", $t02); print OUTFILE ("ms"); }

In reply to Re^2: How to display the .pl process in command line by Anonymous Monk
in thread How to display the .pl process in command line by astronogun

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.