Chas. Owens wrote:
On Sat, Jul 1, 2017, 12:44 Shlomi Fish <shlo...@shlomifish.org <mailto:shlo...@shlomifish.org>> wrote: Hi Shawn! On Sat, 1 Jul 2017 11:32:30 -0400 Shawn H Corey <shawnhco...@gmail.com <mailto:shawnhco...@gmail.com>> wrote: > !!$i which is !(!(0)) which is !(1) which is 0 > I suspect !1 returns an empty string in scalar context. !1 returns PL_sv_no (an internal scalar variable). It is a dualvar that contains the empty string, the int 0 and the double 0.0. depending on the context the value is used in, it will be one of those values. Many people think it is an empty string because the print function forces string context.
perl -e 'my $i =0; $i = defined($i) ? (!!$i) : 0; use Data::Dumper; print Dumper($i);' A printing function should not force a context but use the context it is operating in. How do you print something without having a string context enforced upon you? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/