esmith::Logger - A filehandle abstraction around Syslog.
         use esmith::Logger;

         tie *FH, 'esmith::Logger';
         print FH "log message";
         close FH;

you can do a function

use esmith::Logger;
#we create a function because we want to write in log
 sub log2messages
 {
     my $message = shift;
     tie *FH, 'esmith::Logger';
     print FH "$message";
     close FH;
 }

and now in your code if you want to use it

log2messages("Your error message");