On Aug 23, 2:00 am, [EMAIL PROTECTED] (Lists User) wrote: *snip*
> my %grouplist; > open HD,'groups.txt' or die $!; > > while(<HD>) { > chomp; > my @tmp = split; > my $groupname = shift @tmp; > $grouplist{$groupname} = [EMAIL PROTECTED];} > > close HD; OK, thanks! The Llama presents hashes as single value to a key, so I never thought to make a hash of arrays. Here is what I am using, and I think my comments are correct on how it works: while (<CONFIG>) { # Remove any extra carriage returns chomp; # for each line of the config file, place the entries # into a temp array my @temp = split; # pull the first entry, which is the group name, and put it into # the variable $groupname to be used when creating the 'master' list my $groupname = shift @temp; # Create the hash named grouplist. Each key is the value of $groupname. The values # of the key are what is left of the line we are working with contained in # the array @temp $grouplist{$groupname} = [EMAIL PROTECTED]; } # Close the file handle on the config file close CONFIG; > Do you know how to loop through a hash?If not,please write back to the list. Yes and no. I did some searching and found the following. I think I understand most of it, I'm just not 100% clear on the 'for my' loops. Or should I say that I understand them enough to lift the code from the example and make it work with my script, but don't fully understand the logic behind it. :-) for my $foo ( keys %grouplist ){ *directory check/create code* # File Pull loop # This creates a temp variable named i. It is used as a counter # to tell the loop which entry in the array to pull the vru # number from. The $# gets the number of the last value of the # referenced array and uses it as the number of times to run # through the loop as well as the index for the array. for my $i ( 0 .. $#{ $grouplist{$groupname} } ) { *file pull code* } } Thank you everyone, this has been very helpful! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/