do_this() if (! $interactive); and_this() if (! $interactive); and_this_too() if(! $interactive); #### if (!$interactive) { do_this(); and_this(); and_this_too(); } #### if ( eval { $sftp->put( $file, $target_file, \&callback ); } ne 0 ) #### if ($sftp->put()) { # success } else { # fail } #### writeLog("* * * ABNORMAL COMPLETION * * * Error: $!. Unable to open +file $files_to_sftp" ); print( STDOUT "* * * ABNORMAL COMPLETION * * * Error: $!. Unable to +open file $files_to_sftp\n" ); #### sub set_up_logger { my ($interactive, $batch, $whatever) = @_; sub writeLog { my $msg = shift; if ($interactive) { print STDOUT $msg; } elsif ($batch) { print FILE $msg; } ## whatever whatever } }