Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re: How to connect more arrays to a new array

by integral (Hermit)
on Apr 28, 2003 at 06:28 UTC ( #253604=note: print w/replies, xml ) Need Help??


in reply to Re: How to connect more arrays to a new array
in thread Find unique elements from multiple arrays

Perhaps a solution would be to use the values instead of the keys, but this means that all the data is copied about again, and so is highly unlikely to be the most efficient approach.

my @new = do{local %h; @h{@a,@b,@c,@d} = (@a,@b,@c,@d); values %h};
Adapted from BrowserUk's code

--
integral, resident of freenode's #perl

Replies are listed 'Best First'.
Re: How to connect more arrays to a new array
by Abigail-II (Bishop) on Apr 28, 2003 at 10:00 UTC
    That doesn't solve the problem at all. It fails for exactly the same reason:
    $ perl -le '@a = (undef, ""); @u = do {@h {@a} = @a; values %h}; print + scalar @u' 1 $

    Abigail

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://253604]
help
Chatterbox?
[karlgoethebier]: sometimes rereading manages is helpful ;-) at least for me...
[Eily]: hello people \o/
[karlgoethebier]: manpages..
[Eily]: and non-people and NodeReaper
[Discipulus]: you so kid to greet non people..;=)
Discipulus kind not kid..
[Corion]: The bots bow in response
[Discipulus]: so karlgoethebier, what this idiom is and where i can read about it? i tried to deparse and gives error..;=(
[karlgoethebier]: Eily: non-people == persone non grata?

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2017-07-21 08:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (319 votes). Check out past polls.