Figure 5: perl5 begin and end actions
#!/opt/bin/perl
#
# Example 5 - perl5 begin and end actions.
# Printed second:
print "This is the body.\n";
exit;
BEGIN {
# Printed first:
print "This is the beginning.\n";
}
END {
# Printed third:
print "This is the normal ending.\n";
# This is the place to put normal cleanup, like
# the removal of temporary files.
}
|