When you send a command line to the system shell, the shell creates a process to execute the command. The new process becomes a child of the shell, and its execution does not depend on the shell but coordinates with the shell.
Similarly, a Perl program can start a new process.
Using System () and EXEC ()
The easiest way to build a new process is to use the system operator. Such as:
System ("date");
To send the output to the Now_day file, you can:
System ("Date>now_day") | | Die "Cannot establish now_day documents";
Using single quotes
Another way to generate a process is to place the shell command between two single quotes. Such as:
$nowday = "Now Time:". Date
The $nowday value is the connection between "now time:" And the result of the date command. That is: "Now time: Fri Feb 23:49:23 PDT 1998"
Integrated paradigm
To give a comprehensive example, ask to analyze from date input, week West print "Week unfinished, don't too hard", otherwise print "good work". The concise wording is:
if ('date' = ~ / ^ S /) {
Printf "Welcome to Online Academy, don't be too hard";
} Else {
Printf "Good job n"
}
Date's output format the first byte is a week, and in English it is just the week that does not begin with "s", so a regular expression is used to determine whether the first character is s, and the requirement is met.