reyjrar has asked for the wisdom of the Perl Monks concerning the following question:
so that works and all.. just thought it'd be neater to do a nested ternary operator like:$ref_to_all_lines_in_file # contains all lines in file minus those i +n %hash or @array @array; # contains some lines from the file %hash; # contains array refs $hash_count; # totals all arrays referenced in %hash $array_count; # scalar(@array); $ref if($hash_count) { $ref = \%hash; } elsif($array_count) { $ref = \@array; } else { $ref = $ref_to_all_lines_in_file; }
however, this doesn't seem to be working.. should it be possible to do this? or I am just high off the paint fumes meandering in from the construction on the other side of the wall? :)$ref = $hash_count ? \%hash : { $array_count ? \@array : $ref_to_all_l +ines_in_file };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jcwren) Re: Nested Ternary Operators
by jcwren (Prior) on Nov 20, 2000 at 23:28 UTC | |
|
Re: Nested Ternary Operators
by Dominus (Parson) on Nov 21, 2000 at 00:26 UTC | |
|
Re: Nested Ternary Operators
by KM (Priest) on Nov 20, 2000 at 23:22 UTC |