I've run into a weird issue where the ternary operator isn't doing
what I believe it normally would and need some help understanding the
issue. I'm sure I'm missing some critical point, but perhaps this is
an issue with perl. Here's a short 14 line script exemplifying the
issue:
-code-
#!/
Hi Stan,
Please check my comments below:
On Tue, Apr 3, 2012 at 10:39 PM, Stan N/A wrote:
> I've run into a weird issue where the ternary operator isn't doing
> what I believe it normally would and need some help understanding the
> issue. I'm sure I'm missing some critical point, but perhaps thi
On 2012-04-03 17:39, Stan N/A wrote:
I've run into a weird issue where the ternary operator isn't doing
what I believe it normally would and need some help understanding the
issue. I'm sure I'm missing some critical point, but perhaps this is
an issue with perl. Here's a short 14 line script exem
On 2012-04-03 18:55, timothy adigun wrote:
Hi Stan,
Please check my comments below:
$test{one} eq "first" ?
$test{one} .= " is the worst\n" :
( $test{two} .= " is the best\n");
This is not what the ternary (conditional operator) is for. As I said in
my last post, it is used f
On 04/03/2012 06:55 PM, timothy adigun wrote:
Hi Stan,
Please check my comments below:
On Tue, Apr 3, 2012 at 10:39 PM, Stan N/A wrote:
I've run into a weird issue where the ternary operator isn't doing
what I believe it normally would and need some help understanding the
issue. I'm sure I'm m
On Tue, Apr 03, 2012 at 05:39:10PM -0400, Stan N/A wrote:
> I've run into a weird issue where the ternary operator isn't doing
> what I believe it normally would and need some help understanding the
> issue. I'm sure I'm missing some critical point, but perhaps this is
> an issue with perl. Here's
Hi all,
inspired by this thread, I’ve added this item in my “Perl Elements to Avoid”
page:
http://perl-begin.org/tutorials/bad-elements/#ternary_operator_instead_of_if_else
I added it directly below the item about using map instead of foreach for
side-effects, which exhibits a similar misunderst
Hi Cyril,
I'm CCing the list - I hope it's OK (see the last line of my signature for more
information).
On Wed, 4 Apr 2012 12:22:41 -0400
Cyril Deba wrote:
> Hi Shlomi,
>
> I did read your statement about using ternary statements. So, just to
> confirm. You think that the following is a bad co
Shlomi Fish wrote:
Hi Cyril,
I'm CCing the list - I hope it's OK
I hate handling carbon copies, you always get that black stuff all over
your hands!
John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the oppo
Thanks to everyone for their help! It's been very enlightening!
Stan
On Apr 4, 2012, at 4:51 AM, Shlomi Fish wrote:
> Hi all,
>
> inspired by this thread, I’ve added this item in my “Perl Elements to Avoid”
> page:
>
> http://perl-begin.org/tutorials/bad-elements/#ternary_operator_instead_of_i
On Wed, 04 Apr 2012 03:04:42 -0400, Uri Guttman wrote:
> On 04/03/2012 06:55 PM, timothy adigun wrote:
> that is the wrong way to fix this even if it works.
>
> the ternary operator is meant to return a single value from a choice of
> two expressions. it is not meant for side effects like assignme
On 04/07/2012 06:54 AM, Peter Scott wrote:
On Wed, 04 Apr 2012 03:04:42 -0400, Uri Guttman wrote:
that code is not a good use of ?: at all so use if/else.
Right. And if you want the single statement succinctness, use and/or:
% perl -le '%test = qw(one first two second); $test{one} eq "firs
12 matches
Mail list logo