4 ms·
Note that: while (<>) { ($h{$_}++ == 1) && push (@outputarray, $_); }; Would be written as the following in Raku: my @output-array = lines.unique;
by b2gills 7y ago
Note that:
while (<>) { ($h{$_}++ == 1) && push (@outputarray, $_); };
Would be written as the following in Raku:
my @output-array = lines.unique;
- lizmat 7y agoActually, since the Perl 5 example doesn't chomp (remove newlines), the Raku version would need to be: my @output-array = lines(:!chomp).unique; where the `:!chomp` is a named parameter representing a `False` value for the named parameter `chomp`. AKA, `chomp => False`.