http://www.perlmonks.org?node_id=863193


in reply to Google Translator -> wxPerl frontend

my( $self, $parent, $id, $title, $pos, $size, $style, $name ) = @_ +; $parent = undef unless defined $parent; $id = -1 unless defined $id; $title = "" unless defined $title; $pos = wxDefaultPosition unless defined $pos; $size = wxDefaultSize unless defined $size; $name = "" unless defined $name;

Perl now has the // operator which would simplify that to:

my( $self, $parent, $id, $title, $pos, $size, $style, $name ) = @_ +; $parent //= undef; $id //= -1; $title //= ""; $pos //= wxDefaultPosition; $size //= wxDefaultSize; $name //= "";

Although I don't see much point in assigning undef to a variable that already contains undef?