Remove last three elements
#!/usr/bin/perl use strict; use warnings; my @array = ('a', 'b', 'c', 'd', 'e', 'f'); my @last_3_elements = splice @array, -3; print "@array\n"; print "@last_3_elements\n";