@_ and $_ in Perl

Source: Internet
Author: User
1.@_ is an array of parameters that are placed when a function is passed, and you can take arguments from it,
such as my ($para 1, $para 2 ...) =@_, when a function call is filled with several parameters, it is possible to take several parameters from the array.
2.$_ is the default parameter, which refers to the last variable that the program handles without specifying it, such as
open (in, "<file.txt") while
(<IN>)
{
   print $ _;
}
Close (in);

This example opens a text file, reads each line, and, without specifying a parameter, $_ points to each line read from the file.

Original address: Http://zhidao.baidu.com/link?url=nXRtmOcoSjbjUb5yYunDx03fYAm569JsKCfXCz_ 9ln3mh3zbdqggxjeb6hj-1kcnhgfjdblgtqutdg4u5ipvwa

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.