r/rakulang•
jaldhar

destructuring and placeholders

This actually came up when I was doing Weekly Challenge 366 but I keep forgetting to ask about it.

Let's say I have a time like 07:45. I want the individual digits but I don't want the colon. In Perl I would do something like:

my (hourTens, hourOnes, undef, minuteTens, minuteOnes) = split //, $time;

But Raku doesn't have undef. I could have sworn that you could use _ like some other languages but that apparently doesn't work.

So what I ended up doing was

my (hourTens, hourOnes, (), minuteTens, minuteOnes) = $time.comb;

Which works but is there a better/more idiomatic way?

Posted Apr 9, 2026, 9:16 PM UTC

76
Loading comments…