if ($key =~ m/(node[0-9]*)/) { if ($key = $1) { print "You entered " .$key. ":" . $ref->{$key}. "\n"; } }