Both -w and -T are a kind of "reliable" flags.
-w is the same as the use warning statement in your code, and this is equivalent to warning in many compilers. A simple example would be a warning about using an uninitialized variable:
#!/usr/bin/perl -w print "$A\n"; print "Hello, world!\n";
It will be printed:
Name "main::A" used only once: possible typo at ./perl-warnings line 3. Use of uninitialized value $A in concatenation (.) or string at ./perl-warnings line 3. Hello, world!
The -T flag means that any value received from the outside world (as opposed to computing inside the program) is considered a potential threat and prohibits the use of such values โโin system-related operations, such as writing files, executing a system command, etc. (which is why Perl activates taint mode when the script runs under setuid / setgid.)
The tainted mode forces you to double check the value inside the script.
For example, the code:
#!/usr/bin/perl -T $A = shift; open FILE, ">$A"; print "$A\n"; close FILE;
Will produce a fatal error (program termination):
$ ./perl-tainted jkjk Insecure dependency in open while running with -T switch at ./perl-tainted line 3.
And this is only because the value of the argument was obtained from "outside" and was not "double checked". The taint mode draws your attention to this fact. Of course, it's easy to fool him, for example:
#!/usr/bin/perl -T $A = shift; $A = $1 if $A =~ /(^.*$)/; open FILE, ">$A"; print "$A\n"; close FILE;
In this case, everything worked fine. You have "tricked" the "taint" mode. Well, it is assumed that the programmerโs intent is to make the program more secure, so the programmer will not only cope with the error, but rather take some security measures. One of Perl's aliases is "glue and tape for cable system administrators." It is possible that the system administrator will create a Perl script for his needs and run it with root permissions. Think of this script in order to do something normal users are not allowed to ... you probably want to double-check things that are not part of the program itself, and you want Perl to remind you of them.
Hope this helps.