dog,yes,string1,yes,string2 cat,no,string3 mouse,no,string4,no,string5 horse ferret #### #!/bin/perl use strict; use warnings; use Data::Dumper; my $name="mouse"; open (FH, "datafile.txt")||die "cannot open file"; while ( ) { next unless s/^(.*?):\s*//; $HoA{$1} = [ split /,/ ]; } print Dumper(%HoA); my $success="yes"; my $description="new string"; push @{ $HoA{$name} }, $success, $description; for $venue ( keys %HoA ) { print FH "$venue @{ $HoA{$venue} }\n"; }