SPUG: Slice of HashOfHash

Yitzchak Scott-Thoennes sthoenna at efn.org
Fri Nov 17 14:38:58 PST 2006


Ivan Heffner wrote:
> Use Perl's short-circuiting logical '||'
> to make a single method call (or set of method calls):
>
>   foreach my $family ( $cartoon->families() ) {
>       if ( ( $cartoon->$family->husband() || '' ) eq 'fred') {
>            print "yes\n";
>       }
>   }

Or even:
  ( $cartoon->$family->husband() // '' ) eq 'fred'


More information about the spug-list mailing list