Mega Code Archive

 
Categories / Perl / Array
 

Remove elements from array with splice

#!/usr/bin/perl use strict; use warnings; my @array = ('a', 'b', 'c', 'd', 'e', 'f'); my @removed = splice @array, 2, 3; print "@array\n";    print "@removed\n";