| 49 | | # TODO: repeat ... until, gather/take, lambdas |
| | 50 | #?rakudo skip 'Using match object in a while loop, RT #58352' |
| | 51 | { |
| | 52 | my $str = 'abc'; |
| | 53 | my $count = 0; |
| | 54 | my $match = '';; |
| | 55 | while $str ~~ /b/ { |
| | 56 | $count++; |
| | 57 | $str = ''; |
| | 58 | $match = "$/"; |
| | 59 | } |
| | 60 | ok $count, 'Can match in the condition of a while loop'; |
| | 61 | is $match, 'b', '... and can use $/ in the block'; |
| | 62 | is "$/", 'b', '... and can use $/ outside the block'; |
| | 63 | } |
| | 64 | |
| | 65 | #?rakudo skip 'Using match object in an if statement, RT #58352' |
| | 66 | { |
| | 67 | my $match = ''; |
| | 68 | if 'xyc' ~~ /x/ { |
| | 69 | $match = "$/"; |
| | 70 | } |
| | 71 | is $match, 'x', 'Can match in the condition of an if statement'; |
| | 72 | is "$/", ' x', '... and can use $/ outside the block'; |
| | 73 | } |
| | 74 | |
| | 75 | # TODO: repeat ... until, gather/take, lambdas, if/unless statement modifiers |