my %text = ( p1 => '(file inquiry - launch page)', p2 => '(file search - replace - operators)', p3 => '(file notepad)', b1 => '(file inquiry: old - owners and preowners)', p0 => '(file search)', c0 => '(file search)', c1 => '(file inquiry)', c3 => '(file notepad)', h1 => '(file and arch inquiry and history)'); s!iapw_(\w\d)!qq {\U$1\E} . qq {} . qq { = $text{$1}}!eg for @a_data;