#!/usr/bin/perl -w use strict; use warnings; use diagnostics; use Benchmark; use Getopt::Long qw(:config no_ignore_case bundling); #defines variables my $man = 0; my $help = 0; my $input; my $output; my @blubb; my %options = ( 'help|h' => \$help, 'man' => \$man, 'input|i=s' => \$input, 'output|o=s' => \$output, ); GetOptions(%options); open STDIN, "<$input" or die "Can't open $input: $!" if $input; while() { chomp; push @blubb, $_; } close STDIN if $input; open STDOUT, ">$output" or die "Can't open $output: $!" if $output; print join "\n", @blubb; print "\n"; close STDOUT if $output; exit 0; #### Filehandle STDIN reopened as STDOUT only for output at ex.pl line 36 (#1) (W io) You opened for writing a filehandle that got the same filehandle id as STDIN. This occured because you closed STDIN previously.