Limited Infinity has asked for the wisdom of the Perl Monks concerning the following question:
It generates output as :use strict; use Data::Dumper; $Data::Dumper::Sortkeys = 1; my $object = bless {}, "MyMain"; $object->{a} = bless {}, "A"; $object->{b} = bless {}, "B"; $object->{c} = bless {}, "C"; $object->{a}->{var1} = "Pratik"; $object->{a}->{var2} = bless {}, "A1"; $object->{a}->{var2}->{name} = "Hello"; $object->{b}->{var1} = $object->{a}->{var2}; $object->{c}->{var1} = $object->{a}->{var2}; print Dumper($object); # # Start the magic. # my $dummy = bless {}, "A1"; $dummy->{name} = "CamelNeedsWater"; $object->{a}->{var2} = $dummy; print Dumper($object);
$VAR1 = bless( { 'a' => bless( { 'var1' => 'Pratik', 'var2' => bless( { 'name' => 'Hello' }, 'A1' ) }, 'A' ), 'b' => bless( { 'var1' => $VAR1->{'a'}{'var2'} }, 'B' ), 'c' => bless( { 'var1' => $VAR1->{'a'}{'var2'} }, 'C' ) }, 'MyMain' ); $VAR1 = bless( { 'a' => bless( { 'var1' => 'Pratik', 'var2' => bless( { 'name' => 'CamelNe +edsWater' }, 'A1' ) }, 'A' ), 'b' => bless( { 'var1' => bless( { 'name' => 'Hello' }, 'A1' ) }, 'B' ), 'c' => bless( { 'var1' => $VAR1->{'b'}{'var1'} }, 'C' ) }, 'MyMain' );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Unforseen OO conducts
by Roy Johnson (Monsignor) on Oct 06, 2005 at 13:08 UTC | |
|
Re: Unforseen OO conducts
by Perl Mouse (Chaplain) on Oct 06, 2005 at 13:05 UTC | |
by thor (Priest) on Oct 06, 2005 at 13:23 UTC | |
by Perl Mouse (Chaplain) on Oct 06, 2005 at 13:27 UTC |