my $hostname = call(); $hostname //= "Can't resolve"; # Alternative solution
Or even just
my $hostname = call() // "Can't resolve";
c:\@Work\Perl>perl -wMstrict -le "sub S { return; } ;; my $s = S() // 'cannot resolve'; print qq{'$s'}; " 'cannot resolve'
Give a man a fish: <%-{-{-{-<
In reply to Re^2: Forgot variable syntax for $var = funct() or "Funct failed\n";
by AnomalousMonk
in thread Forgot variable syntax for $var = funct() or "Funct failed\n" / Any experience with is_hostname()
by vlturner
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |