in reply to Converting a String to Array Reference
If the array holds non-numbers (or you don't care that the numbers are saved as strings) you can remove the 'map { ... }' part.my $var ='[1,2]'; my @array = map { 0+$_ } split ',', substr($var,1,-1);
However the CPAN module mentioned in earlier post would do this more safely and support more features.
|
|---|