Saturday, January 1, 2011

Deleting a specific Element from a Perl Array?

Method 1:
my @array = (0,1,2,3,4,5,6);
delete $array[3];    #value only delete
 $"="\n";
print "@array";


Method 2:

my @array = (0,1,2,3,4,5,6);
my @deletes = splice(@array, 3,1);
print "@array";




No comments: