in reply to An error message to understand
Does it mean that one of the @CHOICE array contents are empty?
Yes. You can avoid that warning by checking for definedness:
orforeach (@CHOICE) { if (defined && m/2001\sCensus\sOutput\sArea/){
foreach (@CHOICE) { next if (!defined); if (m/2001\sCensus\sOutput\sArea/){
This uses $_ implicitly in both the definedness test and the pattern match. Often it's clearer to assign the value to a lexical variable:
for my $chosen (@CHOICE) { if (defined $chosen && $chosen =~ m/2001\sCensus\sOutput\sArea/){
As a further comment, usage of upper-case variable names is generally reserved for constants or perl private variables.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: An error message to understand
by Perl Mouse (Chaplain) on Jan 06, 2006 at 12:14 UTC | |
by tirwhan (Abbot) on Jan 06, 2006 at 12:29 UTC |