in reply to Re^2: trouble with evaluate
in thread trouble with evaluate
What "dire warnings" about using our?
Also, you claim that the below parse function works. How does it actually "work"? What do you believe that you're saving in $self->{$var1} and how are you planning on using it?
my $var1; my $var2; my $var3; #set values -- this part works sub parse{ ... $self->{$var1} = 'a'; $self->{$var2} = 'b'; $self->{$var3} = 'c'; ... }
If you're doing true Object Oriented programming, I believe that what you truly want is just the following
package parser; ... # Some constructor here ... #set values -- this part works sub parse{ ... $self->{var1} = 'a'; $self->{var2} = 'b'; $self->{var3} = 'c'; ... } sub get_var{ my ($self, $var_name) = @_; return $self->{$var_name}; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: trouble with evaluate
by genghis (Novice) on Apr 09, 2011 at 02:53 UTC | |
by wind (Priest) on Apr 09, 2011 at 03:10 UTC |