Help for this page

Select Code to Download


  1. or download this
    use Scalar::Util qw[ dualvar ];;
    
    ...
    $rv = alwaysFails();;
    
    print "Sub failed with error: $rv" if !$rv;;
    
  2. or download this
    print "Sub failed with error: $rv" if ! 0+$rv;;
    Sub failed with error: Some text to explain the error
    ...
    
    print "Sub failed with error: $rv" if $rv == 0;;
    Sub failed with error: Some text to explain the error