Front page | perl.beginners |
Postings from April 2008
Trying to splice....
Thread Next
From:
lokeey@gmail.com
Date:
April 10, 2008 04:56
Subject:
Trying to splice....
....@dump 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?
Thread Next
-
Trying to splice....
by lokeey@gmail.com