in reply to Re: merging arrays
in thread merging arrays

When I went to print that out, it appears as though it indexed every position from the original array into this one. Now it has some 100s of undefined values. I guess it really didn't do as I expected. Maybe I should just do a foreach and do it that way?

Replies are listed 'Best First'.
Re^3: merging arrays
by GrandFather (Saint) on Jun 24, 2006 at 04:58 UTC

    Reduce your code to a small sample that shows the problem and post it.


    DWIM is Perl's answer to Gödel
Re^3: merging arrays
by shmem (Chancellor) on Jun 24, 2006 at 11:52 UTC
    That's exactly the expected behaviour. You loop from $a..$n. So you get some value for $a..$n :)
    If you don't want the undefined values, grep for the defined ones:
    my @saved_images = grep { defined $_ } @found_images[0 .. $pics_to_fin +d - 1];
    cheers,
    --shmem
    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}