http://www.perlmonks.org?node_id=966880


in reply to Re^3: get current script as text
in thread get current script as text

mmh, I see... The problem is very silly. I forgot to add a last line to print the variable.

my $codeAsText = do{ local( @ARGV, $/ ) = $0; <>; }; print $codeAsText;

Perhaps you meant:

open (my $foo, $0); print <$foo>; close $foo;

Yes, This solves the problem also, thanks!