Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re^2: splitting a string into arbitrary lengthsby bmann (Priest) |
on Jun 22, 2005 at 22:03 UTC ( [id://469219]=note: print w/replies, xml ) | Need Help?? |
my ($y, $m, $d) = $today =~ /(\d){4}(\d){2}(\d){2}/; You will want to move the closing parens to after the quantifiers for each group of digits, or you'll lose more than just readability ;) As written, the regex will only capture the last digit in each group.
In Section
Seekers of Perl Wisdom
|
|