#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my %hash; my @array; while () { chomp; push @array, split "- " }; %hash = @array; print Dumper(\%hash); __DATA__ ABD - some text ACDB- some more text WD - more text - which spills onto the next line SD - another line