[... use use use use use use ...] my %opt = (min => 10, max => 15,); GetOptions(\%opt, qw(input=s output=s min:i max:i)) or pod2usage(2); { my $in = IO::File->new('-' eq $opt{input} ? '<-' : ($opt{input}, 'r')) or die "could not open $opt{input} for reading: $!\n"; my $out = IO::File->new('-' eq $opt{output} ? '>-' : ($opt{output}, 'w')) or die "could not open $opt{output} for writing: $!\n"; [while ...] } # Handles hier automatisch geschlossen, da Ende des Gültigkeitsbereichs.