if(&mysubroutine()) { ... #continue as mysubroutine was successful } else { ... Something in mysubroutine failed } sub mysubroutine() { my $rc = 0; #this is returned if $rc is not modified which indicates a failure... #as a silly example we will open a file if (open FH, "<./test.txt") { ... #read in file as the open was successful $rc = 1; } return($rc); }