Build a parser.
Marpa::R2 can help you with it:
#!/usr/bin/perl
use warnings;
use strict;
use Marpa::R2;
use Data::Dumper;
my $input = q(name1=value1 name2=' value2=0' name3=value3);
my $dsl = << '__DSL__';
lexeme default = latm => 1
:default ::= action => first
List ::= Pair action => single
| Pair white List action => store
Pair ::= Key '=' Value action => pair
Key ::= noneq
Value ::= word | Quoted
Quoted ::= quote string quote action => second
noneq ~ [^=]+
word ~ [^\s]+
string ~ [^']+
white ~ [\s]+
quote ~ [']
__DSL__
sub first { $_[1] }
sub second { $_[2] }
sub single { [ $_[1] ] }
sub pair { +{ $_[1] => $_[3] } }
sub store { [ $_[1], @{ $_[3] } ] }
my $grammar = 'Marpa::R2::Scanless::G'->new( { source => \$dsl } );
my $value_ref = $grammar->parse( \$input, 'main' );
print Dumper $value_ref;
Output:
$VAR1 = \[
{
'name1' => 'value1'
},
{
'name2' => ' value2=0'
},
{
'name3' => 'value3'
}
];