- or download this
my $line = "1!2!3!4!5!6!7!8!9";
my @arr = split /!/, $line;
...
print "\n";
print join(" : ", @arr[@indices]);#predefined
- or download this
1 : 2 : 3 : 4 : 5 : 6 : 7 : 8 : 9
3 : 6 : 7 : 8 : 9
3 : 6 : 7 : 8 : 9
- or download this
my $line = "1!2!3!4!5!6!7!8!9";
my @arr = split /!/, $line;
...
#set the elements to nothing and then filter them out.
@arr[@exclude] = ();
@arr = grep $_, @arr;