Damian's talks have again inspired me. I've started working on my AI life code again, but first I've taken a detour. This sucks:
print Dumper($foo, $bar, $baz, \%hash);
It works great, but it sucks because I have, on many occasions, forgotten the order of the arguments and I have to bounce back to the code to try and remember what I dumped out. Of course, it's "simple" to fix that with a little known use of Data::Dumper:
[$foo, $bar, $baz, \%hash],
[qw/*foo *bar *baz *hash/]
That will conveniently name all of the variables for you instead of using the cryptic $VAR1, $VAR2, etc. It's still too much typing, though, and if I accidentally transpose a couple of variable names in the second array ref, I get very confused.
So I'm writing a new module which will, hopefully, go to the CPAN soon.
print Dumper($scalar, @array, %hash);
And that prints something like:
$scalar = 'Ovid';
@array = (
%hash = (
'some' => 'data',
'goes' => 'here'
Of course, you may have noticed that I didn't put a backslash before the variable names in the argument list. This is not a typo. And I have it working right now. I have more work to do to get it robust, but so far, it's pretty cool.
And if you forget that references aren't needed, that's okay, because it still works like this:
print Dumper($scalar, \@array, \%hash);