bikeNomad has asked for the wisdom of the Perl Monks concerning the following question:
The following program prints the source text when called with -d, but not without it:
use strict; package DB; BEGIN { $^P |= 0x310 } package main; sub a { print "this is a test"; } printf("\$^P is %x\n", $^P); while (my ($name, $range) = each(%DB::sub)) { my ($filename, $start, $end) = $range =~ /(.+):(\d*)-(\d*)/; next if $filename =~ /^\(/; print "$name\t$filename\t$start - $end\n"; no strict 'refs'; my $lines = \@{'_<' . $filename}; foreach my $lineNumber ($start .. $end) { my $line = $$lines[$lineNumber]; print $line; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using @{"_<$filename"}
by tachyon (Chancellor) on Jul 07, 2001 at 22:21 UTC | |
|
that's @{"_$filename"}
by bikeNomad (Priest) on Jul 07, 2001 at 20:57 UTC | |
|
Re: Using @{"_$filename"}
by japhy (Canon) on Jul 08, 2001 at 19:34 UTC |