> Im trying to pass a hash to a subroutine now. When passing 
> with other variables do I have to pass it as a reference like 
> I do an array. If so how do you dereference it, if you have to at all.

I prefer to pass as a reference. 

# your code was passing an array ref, not a hash, but since you are asking
about
# hashes, i will switch to a hash
my $htmloutput = generate_navIndex( $outputDir, $pageName, \%arrayIndexPages
);
 
# this should work, but i have not tested.  
sub generate_navIndex{
   # the 3rd arg accepts the ref to the hash
   my ( $paramPath, $paramPageName, $paramArrayIndexPages ) = @_;
   my $output = "";
   # deref like you would any has reference
   while ( my ($key, $value) = each( %{$paramArrayIndexPages} ) ) {
        $output .= "$key<br>";
   }
return $output;
}



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

Reply via email to