Copyright © tutorialspoint.com

# PERL use Function

## Syntax

use MODULE LIST use MODULE use VERSION

## Definition and Usage

Imports all the functions exported by MODULE, or only those referred to by LIST, into the name space of the current package. Effectively equivalent to:

    BEGIN
    {
    require "Module.pm";
    Module->import();
    }

Also used to impose compiler directives (pragmas) on the current script, although essentially these are just modules anyway.

Note that a use statement is evaluated at compile time. A require statement is evaluated at execution time.

If the VERSION argument is present between Module and LIST, then the use will call the VERSION method in class Module with the given version as an argument. The default VERSION method, inherited from the UNIVERSAL class.

## Return Value

- Nothing

## Example

        use constant;
        use diagnostics;
        use integer;
        use sigtrap  qw(SEGV BUS);
        use strict   qw(subs vars refs);
        use subs     qw(afunc blurfl);
        use warnings qw(all);
        use sort     qw(stable _quicksort _mergesort);
        use v5.6.1;		# compile time version check
        use 5.6.1;		# ditto
        use 5.006_001;	# ditto

Copyright © tutorialspoint.com