It was Friday, June 20, 2003 when Abhijit Shylanath took the soap box, saying:
: 
: Greets, all. This is my first post here... I'm a seasoned C/C++ programmer,
: and recently started learning perl... it's going along well, and as an
: exercise, I've completely Perl'ed my webpage. I'm still a little dizzy
: because of the different directions it's pulling me towards, but it's fun
: anyway. Chaos always is :-)
: 
: Anyway... the question:
: I need to know if there is a library function in perl to remove an element
: in an arbitrary position in an array.

You're asking about the 'splice' function.  Given array @array

  @array = ( 1, 2, 3 );

If you want to remove the second element (2), you can do that using
splice

  splice @array, 1, 1;
                 ^  ^
                 |  number of elements to remove
                 offset to start at

This will remove one element starting at offset one (everything being
zero indexed).  You can read up on the splice command in the
documentation.

  perldoc -f splice

-- 
Shooting yourself in the foot with Objective-C
You write a protocol for shooting yourself in the foot so that all
people can get shot in their feet.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to