#!/usr/local/bin/perl use strict; use warnings; use B; HERE: B::walkoptree(B::main_root(), "print_label"); THERE: exit(0); sub B::OP::print_label { my $op = shift; if(ref($op) eq 'B::COP') { my $label = $op->label; if(defined($label)) { my $file = $op->file; my $line = $op->line; print "$label: $file: $line\n"; } } }