open my $input, '<', "my_input.xml" or die "Can't open my_input.csv: $!"; # Whoops, my_input.xml does not exist by my_input.csv file does my $input_file = "my_input.xml"; open my $input, '<', $input_file or die "Can't open $input_file: $!"; # Still doesn't work but the error message is correct