# Print Debug output sub p_debug { my $self = shift; return unless $self->{'DEBUG'}; printf "DEBUG: [%04f] %s%s\n", delta_time($last), (' ' x $indent), sprintf(shift @_, @_); return } # Th old way of tracking indent forced me to make sure I was incrementing and decrementing when required. I was looking for a way to automatically increment on entry and automatically decrement on return sub ping { my $self = shift; $self->{'INDENT'}++; .... $self->{'INDENT'}--; return $result; }