use strict; use warnings; use Data::Dumper; my $string = q({file => 'file1', desc => 'test'}, {file => 'file12', desc => 'test2'}); my @array_of_hashes; my @hashes = $string =~ /(\{.*?\})/g; for my $hashstr (@hashes) { my @keys = $hashstr =~ /(\w+)\s*=>/g; my @values = $hashstr =~ /=>\s*\'(\w+)\'/g; my %hash; @hash{@keys} = @values; push @array_of_hashes, \%hash; } print Dumper(\@array_of_hashes); #### $VAR1 = [ { 'desc' => 'test', 'file' => 'file1' }, { 'desc' => 'test2', 'file' => 'file12' } ];