my $rtncode = $ftps->last_status_code; if ( $rtncode != 2 ) { # deal with error }