What purpose does each of the following serve: -w, strict, -
T ?

Answer Posted / savitha sridhar

-w to enable warnings mode
-T to enable Taint mode (TAINT mode puts a Perl script
into "PARANOID" mode and treats ALL user supplied input as
tainted and bad unless the programmer explicitly "OKs" the
data). Usually used when you are using a perl script that
you have downloaded and running but do not want any
security problems.

strict is a pragma in perl used to incorporate strict
programming practices.
Eg:

you could have written a small prog like this:

$x=100;
print $x;

with strict pragma "ON" you will be explicitly required to
specify the scope like,

use strict;
my $x=100; ##use of my to specify scope
print $x;

You can also switch off a pragma by using "no" like below
to switch off the pragma effect:

use strict;
my $x=100; ##use of my to specify scope
print $x;
no strict;
$y=200; ##no need to be specific
print $y;

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does last statement do in perl?

530


What is chomp() operator/function?

566


What is the purpose of “_file_ literal” and “_line_ literal” in perl?

540


How to replace perl array elements?

532


What are the options that can be used to avoid logic errors in perl?

521






Explain what is STDIN, STDOUT and STDERR?

546


How we can navigate the xml documents?

536


What is hash?

556


How can we create perl programs in unix, windows nt, macintosh and os/2 ?

486


What is 'commit' command in perl?

611


Explain regular expression in perl?

532


How can you replace the characters from a string and save the number of replacements?

514


What do you mean by context of a subroutine?

564


Write a program that explains the symbolic table clearly.

536


Mention how many ways you can express string in Perl?

586