- or download this
my $regex = qr/(\d\d):(\d\d)(?::(\d\d))?/;
# 01234567890123456
my $string = "11:30 or 11:29:53";
- or download this
$res = { 0 => ['11', '30', undef],
19 => ['11', '29', '53']
}
- or download this
$res->{pos ($string)} = [$1, $2, $3] while $string = /$regex/g;
- or download this
@res = $string = /$regex/g;