in reply to Re: $0 in perl pod, not expanding to script name
in thread $0 in perl pod, not expanding to script name

Stripped down to the minimum, my code is this: I simply want the first $0 (inside perlpod) to output the script name
=pod Usage: C<$0> =cut $arg = shift(); if (defined($arg) && $arg eq '-h') { print `pod2text $0`; }

Replies are listed 'Best First'.
Re^3: $0 in perl pod, not expanding to script name
by hippo (Archbishop) on Jul 16, 2018 at 08:27 UTC

    In that case, just post-process it:

    =pod Usage: C<$0> =cut $arg = shift(); if (defined($arg) && $arg eq '-h') { for (`pod2text $0`) { s/\$0/$0/; print; } }