package Logger; use Moose; sub log{ my ( $self, $string ) = @_; print $string . "<--- Logged information\n"; } package main; my $Logger = Logger->new; print "Some normal action here\n"; my $debug = "Sometimes I want this"; $Logger->log( $debug );