in reply to join should polymorph on hashes
sub hash_join { my ($hash_ref, $sep1, $sep2) = @_; my $string = ""; $string .= "${_}${sep}$hash_ref->{$_}${sep2}" for sort keys %$hash_ref; $string; } my $string = hash_join \%ENV, " = ", "\n"; print $string;
works just as well, as well as having the benefit of being very obvious as to what you're doing. Your join would have to have too many new arguments, I think. But, that's just my opinion on the matter.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: join should polymorph on hashes
by japhy (Canon) on May 02, 2001 at 01:49 UTC |