in reply to Help with a more precise regex

I think I might be misunderstanding the problem because it seems straightforward:

foreach (<DATA>) { my ($day) = /(\d+)d/; my ($hour) = /(\d+)h/; $_ ||= 0 foreach $day, $hour; print "Day: ($day) Hour: ($hour)\n"; } __DATA__ 3d 3d 2h 6h

The prints:

Day: (3) Hour: (0)
Day: (3) Hour: (2)
Day: (0) Hour: (6)

Cheers,
Ovid

New address of my CGI Course.
Silence is Evil (feel free to copy and distribute widely - note copyright text)

Replies are listed 'Best First'.
Re:^2 Help with a more precise regex
by LogicalChaos (Beadle) on Apr 25, 2003 at 20:02 UTC
    Duh, I couldn't see the trees for the regex forest I had created...

    Thanks for your clear thinking Ovid.

    LogicalChaos
Re: Re: Help with a more precise regex
by Nkuvu (Priest) on Apr 25, 2003 at 20:02 UTC

    *snif* That's beautiful!

    I regret that I have only one ++ vote to give to this note...