Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Re: appending arrays

by kelan (Deacon)
on Nov 19, 2003 at 18:29 UTC ( #308375=note: print w/replies, xml ) Need Help??


in reply to Re: appending arrays
in thread appending arrays

Here's a similar way, without initializing either counter:

push @new, $array1[$count1++].$array2[--$count2] while ($count1 < @array1 && -$count2 < @array2);
By the way, your array accesses are using 1 element slices instead of direct element access. Consider changing @array1[$a1count] to $array1[$a1count].

kelan


Perl6 Grammar Student

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2022-11-26 22:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?