# Scan the argument array for the '-' character and splice it
my $index = 0;
foreach my $arg (@ARGV) {
if ($arg eq "-") {
if ($index > 0 && $index < scalar $#ARGV) {
my $from = $ARGV[$index-1];
my $to = $ARGV[$index+1];
splice(@ARGV, $index-1, 3, ($from .. $to)); # Perl magic
} else {
splice(@ARGV, $index, 1);
warn "Warning: Incorrect use of range specifier '-'\n";
}
}
$index++;
}