develooper Front page | perl.beginners | Postings from June 2011

Re: Use of uninitialized value warnings

Thread Previous | Thread Next
From:
am0c am0c
Date:
June 1, 2011 03:00
Subject:
Re: Use of uninitialized value warnings
Message ID:
BANLkTimAYdNyamxbg0ecci6xLz-K7JDozw@mail.gmail.com
If you use

  $log = $log || '';

instead of

  $log = defined $log ? $log : '';

It might yield a problem because when $log is "0" it is defined but
false in boolean context.
The correct shorter version is:

  $log = $log // '';

And in the line 696:

> 696 my ($log, $pass) = $main::global->{login} ?
> ($main::global->{form}->{'userlogin'}, $main::global->{form}->{'userpass'}) :
> ();

When $main::global->{login} is false, $log and $pass will not be defined anyway.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About