Help for this page

Select Code to Download


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