home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

exec

exec 
command

Terminates the currently running Perl script and executes the program named in command . The Perl program does not resume after the exec unless the exec cannot be run and produces an error. Unlike system , the executed command is not forked off into a child process. An exec completely replaces the script in its current process.

command may be a scalar containing a string with the name of the program to run and any arguments. This string is checked for shell metacharacters, and if there are any, passes the string to /bin/sh/ -c for parsing. Otherwise, the string is read as a program command, bypassing any shell processing. The first word of the string is used as the program name, with any remaining words used as arguments.

command may also be a list value where the first element is parsed as the program name and remaining elements as arguments. For example:

exec 'echo', 'Your arguments are: ', @ARGV;
The exec function is not implemented for Perl on Win32 platforms.











??????????????@Mail.ru