On Sat, 1 Jul 2017 17:27:02 +0200
hw <[email protected]> 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: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/