in reply to A better way than ||
My apologies for not making some things clearer in my haste to simplify the question.
In my code above, the array @weights is pre-defined so I should not have that line to assign each token "0" because it can't possibly be undefined - this enlightenment came after reading the wonderful feedback that I've got from your replies.
The other array @digits is the result of an input from a web form. Specifically, it's an identification number of the shape 9525423E. @digits is gotten using a split:
So @digits should contain 7 numeric characters after the pop. But users may enter an invalid identification number, e.g one that contains only 6 digits instead of 7. So the extra code is need to assign each individual element of @digits a value to prevent the "Use of uninitialized value..." warning.# $input is received from a web submission, # assigned a value here for simplification $input = '9525423E'; @digits = split //, $input; my $letter = uc(pop @digits);
Cheers!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: A better way than ||
by holli (Abbot) on Jan 01, 2006 at 10:55 UTC | |
by Aristotle (Chancellor) on Jan 01, 2006 at 15:38 UTC |