http://www.perlmonks.org?node_id=767823


in reply to Non Greedy?

Some gave you hints to solve your regexp problem. I will give you a quick-n-dirty non-regexp related solution (I will never put a code like this in production):

use strict; use warnings; use Data::Dumper; my $i = "[[{bunches_of_data}, {more_data}, {etc}], [{hey_more_data}, { +etc}, {etc}], [{etc}, {etc}, {etc}]]"; $i =~ s/{|}//g; $i =~ s/([^\[\],\s]+)/'$1'/g; my $iv = eval "$i"; print Dumper $iv;

Outputs:

$VAR1 = [ [ 'bunches_of_data', 'more_data', 'etc' ], [ 'hey_more_data', 'etc', 'etc' ], [ 'etc', 'etc', 'etc' ] ];

citromatik