my $file = get_file(); my $folder = get_folder(); # The function returned an empty string by mistake open my $data, '<', "$folder/$file" or die "Can't open $file; $!"; # But I see the file my folder, why does it say it doesn't exist? my $input_file = "$folder/$input"; open my $data, '<', $input_file or die "Can't open $input_file: $!"; # You'll see straightaway that you the folder is empty