Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: My 'perldar' tells me there is a 'better' solution for this list operation

by Roy Johnson (Monsignor)
on Nov 03, 2006 at 22:34 UTC ( [id://582187]=note: print w/replies, xml ) Need Help??


in reply to My 'perldar' tells me there is a 'better' solution for this list operation

my %hash; @hash{@l2} = @l2; my @newlist = @hash{@l1};
Update: Ah, after two downvotes, I see that the OP wants the string 'null' rather than actual null values. Well, that certainly is worth throwing dung at someone over. Sheesh. One change to the final line:
my @newlist = map defined($_)?$_:'null', @hash{@l1};

Caution: Contents may have been coded under pressure.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://582187]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2024-04-23 11:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found