in reply to using function delete with arrays

As I understand (after taking attention under first warn) - when all array items marked(my first mistake that if I assign every array element to undef and then call scalar(@array) then I've must to get 0 been wrong. Because of that I say "marked" as deleted) as deleted it's realy clear array.. So my new question - where can I get true about "delete" and arrays :).

Thnx for your attention,
Alex.

Replies are listed 'Best First'.
Re^2: using function delete with arrays
by moritz (Cardinal) on Jul 17, 2007 at 11:25 UTC
Re^2: using function delete with arrays
by moritz (Cardinal) on Jul 17, 2007 at 11:40 UTC
    Another idea how to accomplish what you (presumably) want to do:

    use List::Util qw(shuffle); @list = shuffle @list; # now you can just shift() or pop() until @list is empty
Re^2: using function delete with arrays
by dsheroh (Monsignor) on Jul 17, 2007 at 15:12 UTC
    Your understanding is incorrect. scalar(@array) returns the number of elements in an array. Whether the element is defined or not doesn't matter:
    $ perl -e '@arr = (1, 2, 3); print scalar(@arr), "\n"' 3 $ perl -e '@arr = (undef, undef, undef); print scalar(@arr), "\n"' 3