sub read_config_file { my $file_name = shift; open my $FH, '<', $file_name or die "Can't read $file_name: $!\n"; my $result = {}; while (my $line = <$FH>) { my ($key, $value) = split /:/, $line, 2; $value =~ s/\r?\n$//; $result->{$key} = $value; } return $result; } my $config_data = read_config_file('config_file_name.cfg'); print "Daily mission: ", $config_data->{'What are we doing today Brain'}, "\n"; print "Location: ", $config->data{where}, "\n";