my $path = join('', $dir, ($foo || ''), $file); #### my $path = join('', $dir, (defined $foo ? $foo : ''), $file);