in reply to Some more regex

An alternative solution, I would use the regex capture similar/same to what ysth did in the first half of his reply, but combine with the useful @ary = $str =~ /(pattern)/g idiom...
use strict; use warnings; use Data::Dumper; my $str = "[x=1 y=3 z=5] {a=1 b=2 c=3} [d=4 e=5 f=6]"; my @ary = map { /(\w+)=(\d+)/g } # capture foo=bar $str =~ /\[([^\]]+)\]/g; # but only between [ and ] print Dumper(\@ary);