http://qs1969.pair.com?node_id=56956


in reply to extracting numbers from a string

If they are all in fixed positions you can use substr repeatedly to extract the values or you can use a regular expression and assign from the $1-$9 variable.

perldoc -f substr perldoc perlre

the regular expression code would look something like

$filename='XX-ZZ-YYYYMMDDHH' $filename =~ /^(\d{2})-(\d{2})-(\d{4})(\d{2})(\d{2})(\d{2})$/; # $1 is XX, $2 is ZZ, and so on