I thought of that, but did not in order to leave my references empty, similar to the OP's. But, if you insist. :)
perl -Mstrict -MData::Dumper -we '
package Test;
sub new {
my $class = shift;
my $stuff = { shift() => 1};
bless $stuff, $class;
return $stuff;
}
package Main;
my $t = [
Test->new("foo"),
Test->new("bar"),
Test->new("baz"),
];
print "Ref: " . ref($t) . "\n";
print Data::Dumper->Dump([$t], ["for_LanX"]) . "\n";
'
__output__
Ref: ARRAY
$for_LanX = [
bless( {
'foo' => 1
}, 'Test' ),
bless( {
'bar' => 1
}, 'Test' ),
bless( {
'baz' => 1
}, 'Test' )
];
|