in reply to string to array

If you want to extract integers from a string, one way is to use regular expressions (perlre):
use warnings; use strict; use Data::Dumper; my $str = '"[1,2]"'; my @nums = $str =~ /(\d+)/g; print Dumper(\@nums); __END__ $VAR1 = [ '1', '2' ];
See also: