On Wed, Apr 9, 2008 at 3:14 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] into the middle of @players without removing any elements
> from @players.
>
> so i've done the following...
>
> #!/usr/bin/perl -w
>
> # extracting elements using splice
>
> @players = ("ryno", "fukudome", "grace", "banks", "santo",
> "soto", "marmol", "sori", "bigZ", "pie");
> @dump = splice(@players, 0,2, "theriot", "sosa");
> print "The original array is @players\n";
> print "The players dumped after the splice are: @dump.\n";
> print "The spliced array is now @players.\n";
>
>
> ...but I'm not sure I'm doing the splice correct, because the first
> line prints all the players including the ones stated in @dump. should
> i be using negative offset or length?
>
Your first print is after the splice:
@players = ("ryno", "fukudome", "grace", "banks", "santo",
"soto", "marmol", "sori", "bigZ", "pie");
print "The original array is @players\n"; # <== print before splicing
@dump = splice(@players, 0,2, "theriot", "sosa");
print "The players dumped by the splice are: @dump.\n";
print "The spliced array is now @players.\n";
HTH,
-- jay
--------------------------------------------------
This email and attachment(s): [ ] blogable; [ x ] ask first; [ ]
private and confidential
daggerquill [at] gmail [dot] com
http://www.tuaw.com http://www.downloadsquad.com http://www.engatiki.org
values of β will give rise to dom!