greetings

I am trying to return the value from an associate array; i do not understand what i am 
doing wrong. I know i made be reinventing the wheel here if you follow what i am 
trying to do.

thanks


#!/usr/bin/perl -w

%theHash = ();
@dbRec = ();
@listing = ();
@sortedListing = ()
;
# making a directory list

        foreach $f (<data/*>) { if (-f $f) { $theFileItem = "$f\n";

# list populated  into an array;

        push (@listing, $theFileItem);}}

#sorting the list i doubt this works though

        @sortedListing = sort @listing;

        $listLength = @sortedListing;

for ($i=0; $i<= $listLength-1; $i +=1)
        {
                open(INVIN, "$sortedListing[$i]") or die "COULD NOT OPEN $i\n";

                <INVIN>; #ignoring the first line

                        while(<INVIN>)
                                {       $TheLine = $_;
                                        chomp($TheLine);
                                        push(@dbRec, $TheLine);
                                }
        }

        $theHash{'$sortedListing[1]'} =[$dbRec];

        print "\$sortedListing[1] is ($theHash{'$sortedListing[1]'})\n";
~



Reply via email to