#!/usr/bin/perl -w use strict; my $var ='[1,2]'; my @var = split (/[\[\],]/, $var); print "@var";