Perl Scripting Simple Learning

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.