What does the command "use strict" do and why should you
use it?

Answers were Sorted based on User's Feedback



What does the command "use strict" do and why should you use it? ..

Answer / prabin kumar, xansa(ind) chenn

"Use strict" is one of the pragma used for checking the
variable scope and syntax. If you use this pragma means,
you need to specify the scope (my, local, our) for the
variable and use the exact usage of operators.
For eg. Checking equality $number = 1 and $char eq 'a'.

Is This Answer Correct ?    22 Yes 0 No

What does the command "use strict" do and why should you use it? ..

Answer / savitha sridhar

strict is a pragma that can be used to enforce Strict
programming practices while you write your programs.

Eg: You can write a program like this:

$x=100
print $x

But if you use strict pragma, then you have to be very
specific while using variables

use strict;
my $x=100; ##look at the usage of scope like my,local,our
print $x;

Pragma usage can also be used as a toggle

use strict;
my $x=100;
print $x;
no strict; # to toggle strict to "No"
$y=200; ##no need to use scope as strict is disabled
print $y;

Is This Answer Correct ?    17 Yes 0 No

Post New Answer

More CGI Perl Interview Questions

How to convert arrays into a string in perl?

0 Answers  


Can inheritance be used in perl?

0 Answers  


What is a chop() function in perl?

0 Answers  


What does `new $cur->{LINK}' do? (Assume the current package has no new() function of its own.)

0 Answers  


What is the importance of perl warnings? How do you turn them on?

0 Answers  






How to read file into hash array ?

0 Answers  


What happens in dereferencing?

0 Answers  


What is the usage of -i and 0s options?

0 Answers  


What is the easiest way to download the contents of a URL with Perl?

0 Answers  


What is the difference between module and package?

4 Answers   EDS, IBM, Symantec,


sort a word "system" in perl/shell without using built in functions output should be emssty

2 Answers   emc2,


How to open a directory in perl?

0 Answers  


Categories