How to call / push an elem to a hash of array ?

2003-07-18 Thread LI NGOK LAM
my (%LIST, @other_list);

@other_list = ( Unknown Length Data Elems );

foreach my $col (@lists)
{
for (@other_list)
{  
if ( exist $LIST{$col}[0] ) { Do_smth_2 }  # But ERROR either

What should I write here ? So can push vars to $LIST{$col}
}
}


Thanks in advise


Re: How to call / push an elem to a hash of array ?

2003-07-18 Thread Zeus Odin
What are you trying to do? If you could include a brief example, it
would be nice.

Li Ngok Lam wrote:
 my (%LIST, @other_list);
 
 @other_list = ( Unknown Length Data Elems );
 
 foreach my $col (@lists)
 {
 for (@other_list)
 {  
 if ( exist $LIST{$col}[0] ) { Do_smth_2 }  # But ERROR either
 
 What should I write here ? So can push vars to $LIST{$col}
 }
 }
 
 
 Thanks in advise
 




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to call / push an elem to a hash of array ?

2003-07-18 Thread John W. Krahn
Li Ngok Lam wrote:
 
 my (%LIST, @other_list);
 
 @other_list = ( Unknown Length Data Elems );
 
 foreach my $col (@lists)
 {
 for (@other_list)
 {
 if ( exist $LIST{$col}[0] ) { Do_smth_2 }  # But ERROR either

If you want to test if the array has any elements you can do this:

  if ( @{$LIST{$col}} ) { Do_smth_2 }  # But ERROR either


 What should I write here ? So can push vars to $LIST{$col}

  push @{$LIST{$col}}, 'something';

 }
 }


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]