in reply to Hash of Lists Subroutine Problem
When your subroutine is called, it is passed a list of values: key1, value1, ... keyn, valuen, title. One way to avoid this problem is to pass a reference to the hash instead of the contents of the hash:
printurls(\%URLS, $title); ... my ($URLS, $title) = @_; ... while(my($key, $value) = each %$URLS) { print "$key => $value\n"; }
You can also use subroutine prototypes to transparently pass a hashref instead of a hash (I think).
|
|---|