snip > my $ftp = Net::FTP->new($remotehost, Debug => 10) > || do {print FTPLOG "\nCannot connect to $remotehost: $!", > mailme(); return}; snip
This is a bit off topic, but I can't look at code like this without suggesting the following alternative: near the top of your program say: { my $olddie = $SIG{__DIE__}; $SIG{__DIE__} = sub { my $error = shift; $olddie->{$error} if ref $olddie; mailme($error); #other error stuff here }; } Then for the rest of your program you can say my $ftp = Net::FTP->new($remotehost, Debug => 10) or die "Cannot connect to $remotehost: $!"; This allows you to have a complicated error procedure that is common to anywhere you use die(). It also makes your code cleaner. If you want the same functionality without the program ending you can assign your error handler to $SIG{__WARN__} and use warn() instead. ********************************************************************************************************************* ********************************************************************************************************************* I appreciate the suggestion, but if there is a problem I want the progam to email then die. So I would replace the || do lines in the ftp section with a routine call to? : my $olddie = $SIG{__DIE__}; $SIG{__DIE__} = sub { my $error = shift; $olddie->{$error} if ref $olddie; mailme($error); #other error stuff here }; Derek B. Smith OhioHealth IT UNIX / TSM / EDM Teams 614-566-4145 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>