print STDERR join("\x1E", @list),"\x1E\n"; #### sub dbg { return unless $DEBUG; my $dump = 0; ($dump = 1 && shift) if ($_[0] eq ':DUMP:'); $LOGFILE = open_logfile(); foreach my $item (@_) { $str = (($dump && ref $item) ? Dumper($item) : $item)."\x1E\n"; print $LOGFILE POSIX::strftime("%Y%m%d:%H.%M.%S\x1E",localtime).$str if defined $LOGFILE; print STDERR $str unless $QUIET; } } #### #!/usr/bin/perl use Private::Debug 'dbg'; $Private::Debug::DEBUG = 1; $Private::Debug::QUIET = 0; dbg("Hello there", "You fool"); dbg(':DUMP:', "ARGV:", \@ARGV);