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-----
#!/usr/bin/perl
use strict;
use warnings;

my %test = (
    one => "first",
    two => "second"
);

$test{one} eq "first" ?
    $test{one} .= " is the worst\n" :
    $test{two} .= " is the best\n";

print $_ for values %test;
----code----

I believe the output should result with:

first is the worst
second

The output I receive running this test is:

first is the worst
 is the best
second

This seems peculiar! Help!

Stan

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to