in reply to Re: Perlish way of doing this
in thread Perlish way of doing this

Small suggestion to reduce redundancy:
for my $h (\%a1, \%a2) { print join ',', map{ exists $h->{ $_ } ? $_ : '##' } @a; }
Knitpicking is the only way to perfection.
--kap

Replies are listed 'Best First'.
Re^3: Perlish way of doing this
by BrowserUk (Patriarch) on Dec 08, 2004 at 12:16 UTC

    You're right!

    ... except now that you have to explain not only why the OP should be using an array instead of a hash, and hashes instead of arrays, but also why you're escaping your percent signs and why your $h is firing an arrow at the head of a cartoon character with a one eye closed and a dollar sign in the other :)


    Examine what is said, not who speaks.
    "But you should never overestimate the ingenuity of the sceptics to come up with a counter-argument." -Myles Allen
    "Think for yourself!" - Abigail        "Time is a poor substitute for thought"--theorbtwo         "Efficiency is intelligent laziness." -David Dunham
    "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon

      That's why I commented on your comment and did not write a full solution.

      And I'm gonna save your quote about the cartoon character :)) I laughed. Thanks :)

      --kap