Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Pop/shift/delete on array

by betterworld (Curate)
on Jul 14, 2005 at 16:07 UTC ( [id://474932]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @array = qw/tiger dog cat/;
    delete $array[2];
    print scalar @array; # Output is 2
    
  2. or download this
    my @array = qw/tiger dog cat/;
    delete $array[1];
    print scalar @array; # Output is 3
    delete $array[2];
    print scalar @array; # Output is 1
    
  3. or download this
    my @array = qw/tiger dog cat/;
    delete $array[1];
    print scalar @array; # Output is 3
    splice @array, 2;
    print scalar @array; # Output is 2
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-24 19:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found