billyak has asked for the wisdom of the Perl Monks concerning the following question:
my $test = Test->new(123); $test->change(345); print $test->{id}; # Should print 345 package Test; sub new { bless{ id=>$_[1], } } sub change { my($self,$id) = @_; my $t2 = Test->new($id); $self = $t2; # This line is broke }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Object Swaps
by japhy (Canon) on Jan 14, 2002 at 04:31 UTC | |
|
Re: Object Swaps
by gav^ (Curate) on Jan 14, 2002 at 04:50 UTC |