in reply to Converting a String to Array Reference
But anyway, if this is what you have, then I would parse it in the easiest way possible - this is one line.
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...#!/usr/bin/perl -w use strict; my $var ='[1,2]'; my @var = split (/[\[\],]/, $var); print "@var";
|
|---|