in reply to Converting a String to Array Reference

In this specific case you could do it like this:
my $var ='[1,2]'; my @array = map { 0+$_ } split ',', substr($var,1,-1);
If the array holds non-numbers (or you don't care that the numbers are saved as strings) you can remove the 'map { ... }' part.

However the CPAN module mentioned in earlier post would do this more safely and support more features.