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
|
---|
In Section
Seekers of Perl Wisdom