Re:Differences Between Perl 5 and Perl 6
by philh on Wednesday October 07, 2015 @01:39PM
(#10347540)
Perl6 doesn't do this. A function doesn't know if it's being called in scalar or list context.
(I think there might be some movement towards letting a function detect sink (void) context. Then functions with both side effects and return values don't need to calculate the return values when they aren't needed.)
An array (of characters in your example) in a scalar context is the length of the array. I don't know if that's whats happening here, but that's how you do it everywhere else in Perl so it would make sense to do it on strings too.