sub get_split { my $filename = shift; my $switches = shift; my %filesplit; my @digits = $filename =~ /(\d+)/g or die "Error: Could not extract a number from filename '$filename'.\n"; $filesplit{digit} = $digits[$switches->{numindex}]; ### This won't work for files like 01-file01.html!! FIX!! ($filesplit{prefix}, $filesplit{suffix}) = split (/$filesplit{digit}/, $filename, 2); ### This won't work for files like 01-file01.html!! FIX!! return \%filesplit; }