unless ( system( "scp $file $target_host" ) == 0 ) { #error handling code here }