in reply to Re: Match key and return value in some order
in thread Match key and return value in some order

Thanks Monks

I did not think in create another hash for each question

my %lookup; @lookup{@keys} = @values;

Some doubts:
Why concatenate a space to the key?
 my $key = join'',@keys;
and Why $answer = 'The' . $answer;
NP1 have 'the'core even it is not in uppercase the first character.

Thanks this has helped me a lot!!

Replies are listed 'Best First'.
Re: Re: Re: Match key and return value in some order
by BrowserUk (Patriarch) on Nov 04, 2002 at 01:31 UTC

    Why concatenate a space to the key? my $key = join'',@keys;

    That isn't a space, it's the null string. Ie. Two single quotes, with nothing in between.

    and Why $answer = 'The' . $answer; NP1 have 'the'core even it is not in uppercase the first character.

    That's because I didn't recognise that each /tag applied to everything between it and the preceeding tag. My mistake. I'll amend the code above in a few minutes.


    Nah! Your thinking of Simon Templar, originally played by Roger Moore and later by Ian Ogilvy