On Sat, 1 Jul 2017 17:27:02 +0200
hw <h...@gc-24.de> wrote:

> 
> Hi,
> 
> can someone please explain this:
> 
> 
> perl -e 'my $i = 0; $i = defined($i) ? (!!$i) : 0; print "i: $i\n";'
> i:
> 
> 
> Particularly:
> 
> 
> + Why doesn´t it print 1?

Because !!$i is zero

> 
> + How is this not a bug?

Nope, no bug.

> 
> + What is being printed here?

!!$i which is !(!(0)) which is !(1) which is 0

> 
> + How do you do what I intended in perl?
> 

How do we know what you intend?


-- 
Don't stop where the ink does.

        Shawn H Corey

--
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