my %replacehash = ( TEMP1 => $flow->getExeName(), TEMP2 => $flow->getTempName(), TEMP3 => $flow->getData()->getNameType(), ) #### my %replacehash; @replacehash{map { "TEMP$_" } 1 .. 3} = ( $flow->getExeName(), $flow->getTempName(), $flow->getData()->getNameType(), )