while() { chomp $_; # Remove the trailing newline from the contents of $_. my $name = $_; print "$p{$name}\n"; }