http://www.perlmonks.org?node_id=1214029


in reply to Re: Subroutine Time::HiRes::Time redefined ... Help
in thread Subroutine Time::HiRes::Time redefined ... Help

I thought along that same line of thinking and upgraded Time::HiRes, no help.
But, It seems use warnings; Did it! Errors are gone. It seemed a more stylistic choice, but it fixed it. Can you explain?

Sweetblood

  • Comment on Re^2: Subroutine Time::HiRes::Time redefined ... Help

Replies are listed 'Best First'.
Re^3: Subroutine Time::HiRes::Time redefined ... Help
by Laurent_R (Canon) on May 04, 2018 at 08:32 UTC
    Basically, the -w flag is an all-or-nothing construct. It enables warnings everywhere in your code, including in the modules you use and you haven't written yourself. The use warnings; pragma, by contrast, is lexically scoped, so it does not overlap on other pieces of code used in your program. And you can turn it on or off for some chunks of code or for some specific warnings categories.

    I basically use the -w flag only for one-liners. The use warnings; pragma is much better for all other cases.

    See https://perldoc.perl.org/warnings.html#What's-wrong-with-*-w*-and-%24%5eW for more details.