in reply to choping a word!
To take the case that the others have not answered so far, let's assume for a moment that the number of digits is always exactly the same each time and that you want to retrieve several bits of data from the filename. Try a regex. Long form:
Or... more succinctly and idiomatically:use strict; my ($this, $that, $tother, $twix); my $fname = "0092042095432.dat"; if ($fname =~ /^(\d{4})(\d{3})(\d{3})(\d{3})/) { ($this, $that, $tother, $twix) = ($1,$2,$3,$4); } print "$this $that $tother $twix\n"; # ...or whatever
($this, $that, $tother, $twix) = $fname =~ /^(\d{4})(\d{3})(\d{3})(\d{3})/; print "$this $that $tother $twix\n"; # ...or whatever
|
|---|