bArriaM has asked for the wisdom of the Perl Monks concerning the following question:
I'm looking at a script that accepts arguments and stores them in %opts.
There is this line of code at some point:
my $C = exists $opts{'c'} ? '!' : '';
Can this be read as:
my $C = exists $opts{'c'} - if TRUE, $C gets !, if FALSE, $C gets empty string
If I'm right, can you explain a little more about those operators?Thank you!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: exists function used with attributes/operators?
by toolic (Bishop) on Jul 19, 2015 at 02:26 UTC | |
by bArriaM (Novice) on Jul 19, 2015 at 15:31 UTC | |
|
Re: exists function used with attributes/operators?
by AnomalousMonk (Archbishop) on Jul 19, 2015 at 04:48 UTC | |
by bArriaM (Novice) on Jul 19, 2015 at 15:31 UTC | |
|
Re: exists function used with attributes/operators?
by 1nickt (Canon) on Jul 19, 2015 at 11:23 UTC | |
by bArriaM (Novice) on Jul 19, 2015 at 15:32 UTC | |
|
Re: exists function used with attributes/operators?
by Laurent_R (Canon) on Jul 19, 2015 at 10:18 UTC | |
by bArriaM (Novice) on Jul 19, 2015 at 15:32 UTC |