in reply to Changing "filename" of eval-ed code

If i understand what you mean, you may profit of $^P as described in perlvar
$^P= 0x100; # x100 # Provide informative "file" names for evals based on the place th +ey were compiled. perl -wlE "BEGIN{$^P= 0x100}eval '1+1; 1'; eval qq(\n;1+1;2)" Useless use of a constant (2) in void context at (eval 1)[-e:1] line 1 +. Useless use of a constant (2) in void context at (eval 2)[-e:1] line 2 +.

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^2: Changing "filename" of eval-ed code
by perlancar (Hermit) on May 20, 2016 at 12:07 UTC
    Ah, thanks. This is not 100% what I wished for, but it certainly helps. And I notice there is also $^P=0x200 for the anonymous subroutine counterpart. Nice.