#!/usr/bin/perl -- use strict; use warnings; sub dd { use Data::Dumper; print Data::Dumper->new([@_])->Useqq(1)->Dump, "\n"; } Subroutine dd redefined at - line 5. my $cool = qr/ (? \s* (?\w+) \s* (?\w+) \s* (?\d*) ) /x; my $beans = 'castor cocoa coffee pinto navy Mayocoba'; while( $beans =~ m{$cool}g ){ dd( \%+ ); } __END__ $VAR1 = { "NEVER" => "", "key2" => "castor", "keyQ" => "cocoa", "key" => "castor cocoa " }; $VAR1 = { "NEVER" => "", "key2" => "coffee", "keyQ" => "pinto", "key" => "coffee pinto " }; $VAR1 = { "NEVER" => "", "key2" => "navy", "keyQ" => "Mayocoba", "key" => "navy Mayocoba" };