Exception handling syntax: Difference between revisions

Content deleted Content added
Perl: expand entry using Matt Sergeant's presentation "Exception Handling in Perl" -
Line 193:
except IOError:
print "Unable to open file"
except: # catch all exceptions
print "Unexpected error"
else: # executed if no exceptions are raised
finally: # clean-up actions
print "File write completed successfully"
finally: # clean-up actions, always executed
if f:
f.close()