Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hello monks, could you please help me understand this syntax? Why do we have parentheses around FOO/BAR in the hash? Thanks a bunch!
use constant FOO => 10; use constant BAR => 20; %BAZ = ( FOO() => 1, BAR() => 1 ); sub is_baz { my $i = shift; return ( exists $BAZ{$i} ) ? 1 : 0; } .... is_baz(10);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: understanding this syntax
by kennethk (Abbot) on Oct 01, 2010 at 15:51 UTC | |
|
Re: understanding this syntax
by ikegami (Patriarch) on Oct 01, 2010 at 16:10 UTC | |
by Anonymous Monk on Oct 01, 2010 at 20:00 UTC | |
|
Re: understanding this syntax
by molecules (Monk) on Oct 01, 2010 at 17:31 UTC | |
|
Re: understanding this syntax
by TomDLux (Vicar) on Oct 02, 2010 at 05:09 UTC |