Hi, In this example, to 'catch' if the socket could not be created, by using -> or die "....";
#!/usr/bin/perl -w use IO::Socket; $remote = IO::Socket::INET->new( Proto => "tcp", PeerAddr => "localhost", PeerPort => "daytime(13)", ) or die "cannot connect to daytime port at localhost"; How can I use 'if' statement? So I can handle the exception better. $remote = IO::Socket::INET->new( Proto => "tcp", PeerAddr => "localhost", PeerPort => "daytime(13)", ); if (...) { cleanup(); print "socket error"; exit(0); } I dont know how to check if a handle has not ben created. Anyone can explain to me? Thanks, pot __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]