What is the shortest way to convert string characters to a character array in Perl?

If I have the string "abcd", what is the shortest way to convert to @arr containing qw (abcd)?

+8
perl
source share
2 answers
my @arr = split //, "abcd"; my @arr = "abcd" =~ /./sg; my @arr = unpack '(A)*', 'abcd'; 
+20
source share

The easiest way is with a regex section that matches something.

 my @arr = split //, "abcd"; 
+4
source share

All Articles