in reply to Overwritten instance variables
use strict; use warnings; sub new { my $self = {}; my $class = shift; $self->{input_enc} = shift; unless (defined $self->{input_enc}) { $self->{input_enc} = "euc-jp"; } #... bless($self, $class); return $self; }
By using strict you are forced to declare your variables with my or our, making it more obvious how they are scoped. And it catches typos in variable names for you at compile time.
|
|---|