develooper Front page | perl.perl6.language | Postings from April 2005

Question about list context for String.chars

Thread Next
From:
gcomnz
Date:
April 11, 2005 11:04
Subject:
Question about list context for String.chars
Message ID:
fb07797705041111035357ff89@mail.gmail.com
Hi all, 

I'm writing a bunch of examples for perl 6 pleac and it seems rather
natural to expect $string.chars to return a list of unicode chars in
list context, however I can't find anything to confirm that. (The
other alternatives being split and unpack.)

# unpack
@array = unpack("C*", $string);
# split
@array = split /./, $string;
# this too?
@array = $string.split(/./)
# and how about this?
@array = $string.chars
# and this explicit list context?
@array = $string.chars[];

Thanks,

Marcus

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About