The scripting language uses an interpreter to execute script code. For most divisions languages, the interpreter can be run interactively. Simple example://This example demonstrates the use of the scripting language Python, after the script interpreter Python launches, it displays >>> as a prompt//at the prompt, you can enter the Python statement, and the results will be displayed interactively. Press the key combination ctrl -d to exit the interpreter Scenario 1: Write directly under the console/////////////////////////////////////////////////////[email protected ]:~$ pythonpython 2.6.5 (r265:79063, oct 1 2012, 22:04:36) //version and run time [gcc 4.4.3] on linux2type "Help", "copyright", "credits" or "License" for more information.>>> x=5 //correct practice, output 5>> > print x5>>> exit () //exit//The following are some grammatical errors that are interesting to look at without prejudice to the simple category. >>> x=? //syntax error File "<stdin>", line 1 x=? ^syntaxerror: invalid syntax>>> x=t Traceback (most recent call last): file "<stdin>", line 1, in <module>nameerror: name ' t ' is not defined> >> x=5 //correct practice, output 5>>> print x5>>> exituse Exit () or Ctrl-D (i.e. eof) to exit>>> exit () // Exit Scenario 2: Scripting language file////////////////////////////////////feng.pl//////////////////////////////////////////$count =3;if ($count >2) { print "Welcome";} How to do it and see the following: Perl feng.pl Of course this is one way, and there is another way: The run script will pass the statements in the script file into the interpreter with a pipeline. perl > feng.pl
Symbol # Starts a comment, and everything behind it is considered part of the comment
Symbol $ Description The remainder of the string is the name of a variable
The symbol \ is an escape character that indicates that the next char will appear literally
Perl dirsize.pl
Running the script in this way provides the script file as a command-line argument to the interpreter
The file/home/dong123/zai.pl changed on disk.
Perl Scripting Simple Learning