my %myHash = (hello=>"Howdy", goodbye=>"See ya"); while () { s/\$(\w+)/$myHash{$1}/eg; print; } __DATA__ When I want to say hello I say $hello. When I want to say goodbye I say $goodbye!