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


in reply to Re: RFC: Data::Dumper::Simple
in thread RFC: Data::Dumper::Simple

That fails because eval is limited to the current lexical scope, hence Aristotle's suggestion to use PadWalker.

do { my @array = ( qw/foo bar/ ); print MyDumper(qw/@array/); }; sub MyDumper { my @values; for (@values = @_) { s/^([%@])/\\$1/; $_ .= ','; } my @names; for (@names = @_) { s/^[%@]/*/; s/^\$//; } + return eval "use Data::Dumper;Data::Dumper->Dump([@values],[qw/@na +mes/])"; }

Cheers,
Ovid

New address of my CGI Course.