Binary strings: Difference between revisions
m
→{{header|Perl 6}}: Update to modern syntax.
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: Update to modern syntax.) |
|||
Line 2,157:
=={{header|Perl 6}}==
{{Works with|rakudo|
<lang perl6># Perl 6 is perfectly fine with NUL *characters* in strings:
my Str $s = 'nema' ~ 0.chr ~ 'problema!';
Line 2,201:
# A couple of operators for our new type:
multi infix:<cmp>(ByteStr $x, ByteStr $y) { $x.bytes.join cmp $y.bytes.join }
multi infix:<~> (ByteStr $x, ByteStr $y) { ByteStr.new(:bytes(|$x.bytes, |$y.bytes)) }
|