Gautam Gopalakrishnan writes: > Hello, > > I've tried the archives and the 'Perl 6 essentials' book and I can't > find anything > about string subscripting. Since $a[0] cannot be mistaken for array subscripting > anymore, could this now be used to peep into scalars? Looks easier than using > substr or unpack. Hope I've not missed anything obvious.
Well, no, it can't really. $a[0] now means what Perl 5 called $a->[0] (or @$a[0]). So it's still an array subscript, it's just subscripting $a, not @a. But there's talk about using the various character type methods to return lists of characters. So if you want the first byte of your string, you can say: $str.bytes[0]; And if you want the first codepoint: $str.codepoints[0]; Etc. Luke