#! perl -slw use strict; use Data::Dumper; my %h = split ' ', do{ local $/; }; print Dumper \%h; __DATA__ host1 1.1.1.1 host2 2.2.2.2 host3 3.3.3.3 host4 4.4.4.4