Re: handling lists in perl
- Date: Wed, 19 Dec 2018 16:53:44 +0000
- From: Andy Smith <andy@xxxxxxxxxxxxxx>
- Subject: Re: handling lists in perl
On Wed, Dec 19, 2018 at 09:23:59AM +0000, mick crane wrote:
> just to be a bit clearer.
> given a list A of *unique* numbers
> and a list B of possible pairings find which pairs you can make from the
> list A.
> 6 can pair with 100 and 15 can pair with 100 but they cannot both be
> in the list of possible pairings because there is only one 100.
You don't have two lists though; you have a list and a hash. By
using the correct Perl terminology it will become a lot clearer what
you want to achieve.
You have a LIST of numbers.
You have a HASH that contains KEYS and VALUES.
Do you want to match the KEYS from the HASH with the numbers in the
LIST, or the VALUES from the HASH with the numbers from the LIST?
And do you want to return what was matched or the KEYS of what was
Since the HASH can have multiple instances of the same VALUE but
with different KEYS, if you are matching the VALUE against something
what do you want to do when there is more than one instance of the
You saying, "a list B of possible pairings find which pairs you can
make from the list A" doesn't help when B is actually a hash,
because hashes have keys and values, so we don't know if you mean to
"make pairings" with the key or the value, nor is it entirely clear
what "make a pairing" means. We can guess you mean "is equal to"
once we know which thing you want it to be equal to, but it's still
a guess. Why make us guess? Just say "check for equality" or
something if that is what you mean. :)
https://bitfolk.com/ -- No-nonsense VPS hosting