mrguy123 has asked for the wisdom of the Perl Monks concerning the following question:
If I print it (using the dumper) I get:sub new { my ($class, $hash) = @_; my $this = {}; bless($this, $class); $this->{clean} = $hash; $this->{dirty} = \%orig_graph; print Dumper $this; die (0); return $this; }
As you can see, clean points to dirty, so I can't change one without the other.$VAR1 = bless( { 'dirty' => { 'a' => 1, 'b' => 2 }, 'clean' => $VAR1->{'dirty'} }, 'Edges' );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using the same hashes as different object variables
by JavaFan (Canon) on Jan 20, 2010 at 12:24 UTC | |
by mrguy123 (Hermit) on Jan 20, 2010 at 12:38 UTC | |
by WizardOfUz (Friar) on Jan 20, 2010 at 13:03 UTC | |
by trwww (Priest) on Jan 20, 2010 at 13:12 UTC | |
|
Re: Using the same hashes as different object variables
by cdarke (Prior) on Jan 20, 2010 at 13:17 UTC | |
|
Re: Using the same hashes as different object variables
by BioLion (Curate) on Jan 20, 2010 at 13:06 UTC | |
|
Re: Using the same hashes as different object variables
by ack (Deacon) on Jan 20, 2010 at 16:34 UTC |