in reply to Why so strict?

You say, re your second code block, "Works just fine."

That's interesting. My milage varies:

C:\>perl -E "use 5.018; use strict; my $c; $c = &func() ? say '$c foun +d!' : say 'None!';" Undefined subroutine &main::func called at -e line 1.
... but...
C:\>perl -E "use 5.018; use strict; sub func {say 'in func()';}my $c; +$c = &func() ? say '$c found!' : say 'None!';" in func() $c found!

Aside from returning the declaration of $c to the one liner and the variant quoting, I see no diffs. Can you explain?


++$anecdote ne $data


Replies are listed 'Best First'.
Re^2: Why so strict?
by Laurent_R (Canon) on Nov 12, 2014 at 18:28 UTC
    The original post quite possibly did not contain the full code. Maybe the func subroutine is defined somewhere else.