$ ./1.get_opt.pl --configfile C --outfile /home/bob/Documents/meditations/Algorithm-Markov-Multiorder-Learner-master/output/1.txt --infile /home/bob/Documents/meditations/Algorithm-Markov-Multiorder-Learner-master/data/2.short.shelley.txt Use of uninitialized value $inFH in at ./1.get_opt.pl line 34. readline() on unopened filehandle at ./1.get_opt.pl line 34. $ cat 1.get_opt.pl #!/usr/bin/perl -w use 5.011; use Getopt::Long; my $outfile = undef; my $configfile = undef; my $infile = undef; if ( !Getopt::Long::GetOptions( "outfile=s", \$outfile, "infile=s", \$infile, "configfile=s", \$configfile, "help", sub { print "Usage : $0 --configfile C [--outfile O] [--infile I] [--help]\n"; exit 0; }, ) ) { die "error, commandline"; } die "configfile is needed (via --configfile)" unless defined $configfile; my $inFH; if ( defined($infile) ) { open my $inFH, '<', $infile or die "opening input file $infile, $!"; } my $instr; { local $/ = undef; $instr = <$inFH> } if ( defined($instr) ) { say "input is $instr"; } $