Johannes Schindelin <johannes.schinde...@gmx.de> wrote:
> I guess I do not understand, still, what the difference is between using
> -w and adding `use warnings` *very early* in the script... Could you give
> an example where it makes a difference?

"use warnings" won't leak across files/modules.  In the following
example, only the "useless use of join or string in void context"
from void.perl gets shown w/o -w.  The VoidExample.pm warning
can get lost.

----- VoidExample.pm ------
package VoidExample;
use strict;
# use warnings; # uncomment to trigger warning on next line:
join('', qw(a b c));

1;
------ void.perl ------
#!/usr/bin/perl
use strict;
use warnings;
use VoidExample;

join('', qw(a b c)); # warns
----------8<----------

$ perl -I . void.perl    # 1 warning
$ perl -w -I . void.perl # 2 warnings

Reply via email to