"my" variable $id masks earlier declaration in same scope #### if ( my $id = $obj->get_id() ) { $obj->do_this(); } elsif ( my $id = $obj->create_id() ) { $obj->do_that(); } else { $obj->do_somethingelse(); } #### my $id ; if ( $id = $obj->get_id() ) { $obj->do_this(); } elsif ( $id = $obj->create_id() ) { $obj->do_that(); } else { $obj->do_somethingelse(); }