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

Hi, I am a accountant. I am preparing a balance sheet but because of staff shortage and time pressures I cant complete it on time. There is lot of common data with last years which I need not retype and I can manage by editing last year’s balance sheet ? Is their any software on net where I can do this easily??

0 Answers  


How to find out the version of PERL being installed on your LINUX machine.

4 Answers   Mind Tree,


Write a program to concatenate the $firststring and $secondstring and result of these strings should be separated by a single space.

0 Answers  


Does Perl have objects? If yes, then does it force you to use objects? If no, then why?

0 Answers  


What do the symbols $ @ and % mean when prefixing a variable?

1 Answers   Barclays,






What are the advantages and disadvantages of perl language?

0 Answers  


Explain lists and ivalue?

0 Answers  


How to turn on Perl warnings? Why is that important?

0 Answers  


What does the qq{ } operator do?

0 Answers  


What does 'do' statement do in perl?

0 Answers  


What are the various perl data types based on the context?

0 Answers  


How do I sort a hash by the hash key?

0 Answers  


Categories