in reply to string to array

Some, untested, ways:
@array = $str =~ /[^][,]/g; @array = $str =~ /[0-9]/g; @array = split ',', substr $str, 1, -1; @array = do {my %h = split //, $str; grep {defined} values %h};
It's hard to determine from a single, simple, example what you really want.