for my $str (@strings) { my @array = split /:/, $str; print "$array[-1] \n"; }