In a,hopefully futile, effort to confuse programmers, the use directive, was given a second job to do. It turns other compiler directives on and off. For example, you might want to force Perl to use integer math instead of floating-point match to speed up certain sections of your program.
Remember all of the new terminology that was developed for objects? The computer scientists have also developed their own term for a compiler directive. And that term is Pragma. The use statement controls the other pragmas.
The listing below shows a program that uses the integer pragma integer.pl:
print("Floating point math: ", 10 / 3, "\n"); use integer; print("Integer math: " 10 / 3, "\n");
This program displays:
Floating point math: 3.33333333333333 Integer math: 3
Pragmas can be turned off using the no compiler directive. For example, the following statement turns off the integer pragma:
no integer;
Here is a list of the pragmas that you can use.