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 | |
|
Re: Re: Help with a more precise regex
by Nkuvu (Priest) on Apr 25, 2003 at 20:02 UTC |