Make the conditional part conditional:). Eg.
$str =~ m[
(\d{1,4})
(?:
\t
(.{1,40})
)? # << $2 is condtional.
]x;
Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller