Web | This Site

Perl Home
PERL Functions
© 2011 TutorialsPoint.COM

| Home |  | References |  | About TP |  | Advertising

# PERL warn Function

## Syntax

warn LIST

## Definition and Usage

Prints the value of LIST to STDERR. Basically the same as the die function except that no call is made to the exit and no exception is raised within an eval statement. This can be useful to raise an error without causing the script to terminate prematurely.

If the variable $@ contains a value (from a previous eval call) and LIST is empty, then the value of $@ is printed with .\t.caught. appended to the end. If both $@ and LIST are empty, then .Warning: Something.s wrong. is printed.

## Return Value

- Nothing

## Example

    #!/usr/bin/perl -w

    warn("Unable to calculate value, using defaults instead.\n");

It will produce following results:

    Unable to calculate value, using defaults instead

Advertisement

Online Image Processing

Indian Baby Names