; sub capture (&;*) { my $code = shift ; my $fh = shift || select ; local $output ; no strict 'refs' ; if ( my $to = tied *$fh ) { my $tc = ref $to ; bless $to, __PACKAGE__ ; &{$code}() ; bless $to, $tc } else { tie *$fh , __PACKAGE__ ; &{$code}() ; untie *$fh } ; \$output } #### use strict; use warnings; use XML::Simple; ; use Data::Dumper::Simple; my $struct = XMLin('test.xml'); ; print Dumper($struct); if (defined $struct) { my $result_set = process_data($struct); ; print Dumper($result_set); send($result_set); } #... #### perl -ne 'next if m{^\s*;\s*[^#]}; print $_' debugging.pl > stripped.pl #### print <