use strict; use warnings; my %punct = ( '?' => 'question mark', ',' => 'comma', '(' => 'open bracket', # per your terminology ); while( my ( $symbol, $descr ) = each %punct ) { print "[$symbol] = $descr\n"; }