in reply to Trying to read a file into a Hash of Arrays

You have opened a file for reading input but, you are trying to write into it.

Filehandle FH opened only for input at pl.pl line 18, <FH> line 5

Open the file in read/write mode as below,

#!/bin/perl use strict; use warnings; use Data::Dumper; my $name="mouse"; pen (FH, "+<","datafile.txt")||die "cannot open file"; my (%HoA,$venue); while ( <FH> ) { 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"; }
Update:

++Athanasius,Missed use strict; part.


All is well. I learn by answering your questions...