A line of code from a perl script I have inherited is giving me the wonderful warning:
The line looks like this:Use of uninitialized value in string ne ...
Searhing perlmonks shows quite clearly that one of the two variable is undefined. So I feel well equipted to solve this problem.if ($this_loc ne $last_loc) {
Since $this_loc is read from a database and $last_loc is simply the value of the last $this_loc I deduce that its $this_loc which is getting undefined while being read from the database.
So my trival question is: If you define the variable at the start of the code:
..as they have done at the start of the script.. how can the act of updating the contents of the value clobber this variable?my $this_loc = -111;
Would it not just contain a null string if nothing was found in the database - but still exist?$this_loc = $rowDivData->{LOCATION_ID};
___ /\__\ Creative Object World (COW) \/__/ www.wolispace.com/cow
In reply to A bit more clarity on uninitialized value in string ne by wolis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |