in reply to Read a file into a hash

Here is a solution using regex grouping

perl -le '$_="port: 8888";$hash1{$1}=$2 if m/(.*)\s*:\s*(.*)/;print $h +ash1{port}' 8888