Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
How can I check if value exists before actually use it ?sub get_attribute { my ( $self, $attribute ) = @_; if ((exists( $self->{ATTRIBUTES} )) and ( defined( ${ $self->{ +ATTRIBUTES} }{$attribute} ) ) ) { return ${ $self->{ATTRIBUTES} }{$attribute}; } return undef; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Use of uninitialized value in hash element at
by wind (Priest) on Apr 05, 2011 at 20:55 UTC | |
by zwon (Abbot) on Apr 06, 2011 at 12:50 UTC | |
by Anonymous Monk on Apr 27, 2011 at 17:12 UTC | |
by zwon (Abbot) on Apr 27, 2011 at 17:21 UTC | |
by Anonymous Monk on Apr 27, 2011 at 18:09 UTC | |
|