my $test="[1,2,3]"; my @var = $test =~ /\d+/g; print Dumper \@var;