#! /usr/bin/perl use strict; use warnings; use diagnostics; #--- #my $globalFormPageCfgFile = 'text.txt'; #my $globalFormPageCfgFile = 'textxxxxx.txt'; my $globalFormPageCfgFile = ''; my $pageSizeForForm = ''; #--- sub readFileIntoHash{ my $inputFile = shift || return; print "using input file $inputFile\n" ; if (-e $inputFile){ open (HASHFILE,$inputFile) || die "file $inputFile konnte nicht geoeffnet werden\n"; my %exportHash = map { chomp; split /=/, $_, 2; } ; close(HASHFILE); return \%exportHash; } else{ print "file $inputFile does not exist, returning undef\n"; return; } } #--- my $Hashref = readFileIntoHash($globalFormPageCfgFile); if (defined $Hashref){ print "\n%Hashref is defined \n it contains " . keys(%{$Hashref}) ."\n" ; $Hashref->{'pageCount'} = $pageSizeForForm; } else{ print "file $globalFormPageCfgFile does not exist, sorry!\n"; }