in reply to Re^2: Sequential defined-or operators
in thread Sequential defined-or operators
Just be careful with precedence. Absent prototypes overriding the default,
meansmy $value = $hash{$arg} // func $arg // 'default';
my $value = $hash{$arg} // func($arg // 'default');
Putting parens around the low precedence bit solves the problem.
my $value = $hash{$arg} // (func $arg) // 'default';
Of course, with functions, you can also do
my $value = $hash{$arg} // func($arg) // 'default';
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Sequential defined-or operators
by naikonta (Curate) on Jan 16, 2008 at 16:54 UTC |