main.pl: #/usr/bin/perl print "Entry point\n"; log('started'); sub log { # do the usual to open the logile # now print it print LOG @_; # close it }