in reply to Converting a String to Array Reference

This looks a bit strange for an internal variable. I would guess that something like this would come from the outside via a file, etc. Maybe a config file? If that's true, then there are better config modules and syntax for this.

But anyway, if this is what you have, then I would parse it in the easiest way possible - this is one line.

#!/usr/bin/perl -w use strict; my $var ='[1,2]'; my @var = split (/[\[\],]/, $var); print "@var";
This says to split the line based upon the character set of [ ] ,. The required \ escape characters confuse this a bit, but that's all there is to it. to use array ref to this just push \@var on some list...