my %hash; while ( ) { my ( $key, $value ) = split /\|/, $_, 2; next unless $key; $hash{$key} = $value; }