Artist: Rock Title: Fusion Album: Fusion Year: 2002 Genre: Other Artist: MelB Title: who am i: Album: donny Year: 2004 Genre: Other Artist: bon jo Title: i can stay Album : Armyman Year: 2009 Genre: Other Artist: Pearl Title: Last Album: Jam Year: 1983 Genre: Other #### Artist Title Album Year Genre ------ ----- ----- ----- ----- Rock bbb hhh 2000 POP MelB Hum por 2003 other bon jo Armyman 209 others #### #!/usr/bin/perl use warnings; use strict; my %hasharray; open (my $fh, "<", "C:/songdata1.txt") or die "can't open the file"; while (<$fh>){ my ($header,$info) = split /:/; } #### #!/usr/bin/perl -p00 use warnings; use strict; open (my $fh, "<", "C:/songdata1.txt") or die "can't open the file: $!\n"; # $! gives a clue my %hash; while (<$fh>){ chomp; my @array = split /\n/, $_; for (@array) { my ($header,$info) = split /\s*:\s*/; # eliminate blanks before/after ':' $hash{$header} = $info; } write; } format TOP = Artist Title Album Year Genre ------ ----- ----- ---- ----- . format STDOUT = @<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<< @<<<<<<<<<<<<< $hash{Artist}, $hash{Title}, $hash{Album}, $hash{Year}, $hash{Genre} . #### @hash{ qw(Artist Title Album Year Genre) }