in reply to variable array names

You probably don't want to be using the symbolic references to be doing this, they are generally considered evil and unnecessary in most applications. Instead you probably want to be using a hash - something like:

$element_count=0; my %CLIQUE_DETAILS; foreach $element (@CLIQUE_ID_START_LINES) { if ($element != $CLIQUE_ID_START_LINES[$#CLIQUE_ID_START_LINES]) { for ($i = $element; $i<=$CLIQUE_ID_START_LINES[$element_count+1] +; $i++) { if ( not exists $CLIQUE_DETAILS{$element_count} ) { $CLIQUE_DETAILS{$element_count} = []; } push(@{$CLIQUE_DETAILS{$element_count}}, $VCONFIG[$i]); } $element_count++ }
Of course that is untested as I don't have your data.

/J\

Replies are listed 'Best First'.
Re^2: variable array names
by Eimi Metamorphoumai (Deacon) on Oct 15, 2004 at 14:57 UTC
    If $element_count is an integer, then there's no reason to use a hash instead of an array. So what you really want is an array of arrays, thus.
    $element_count = 0; foreach $element (@CLIQUE_ID_START_LINES) { if ($element != $CLIQUE_ID_START_LINES[-1]) { for my $i ($element..$CLIQUE_ID_START_LINES[$element_count+1]) { push(@{$CLIQUE_DETAILS->[$element_count]}, $VCONFIG[$i]); } $element_count++ }
      identifying the array name as a hash worked perfectly. Thank you both for your extremely helpful replies. Best regards- Matt