in reply to Novice flails arrays

I'd eliminate the WGL; it is redundant. Perhaps a hash is what you are looking for?
my %zone; foreach my $name (AA..ZZ) { $zone{$name} = [ qw|FALSE FALSE| ]; }
Note that I did not include the name in the array; it is redundant with the key. To access the boolean flags associated with name 'fo', use
my ($flag0, $flag1) = @{ $zone{fo} }; # or my $flag0 = $zone{fo}[0]; my $flag1 = $zone{fo}[1];

-Mark

Replies are listed 'Best First'.
Re: Re: Novice flails arrays
by wa4otj (Beadle) on Mar 26, 2004 at 22:04 UTC

    Maybe eliminating WGL is a good idea. It actually signifies that the variable in question is tied to the PIC device, which is made by WGL Designs. Z indicates the variable is related to a specific Zone. So they do have meaning. But perhaps it is not necessary. It does contribute to readability in the larger program as the reader knows what any variable named WGL refers to. There are many other variables that refer to other parts of the system.

    Thanks, I will study your examples.

    Nathan