Common Perl syntax records

Source: Internet
Author: User

Common Perl syntax records

##包的切换和调用其它包的方式#package A;#my $a=10;#package B;#print $A::a;#print $a;  ##local局部标识符的使用#$aa=20;#{#local $aa;#$aa=10;#print "$aa \n";##}#print $aa;##别名的使用=comment$b=10;$a=1;$c=200;{local *b;*b=*a;$b=20;print "$a \n";}*d=*c;$d=100;print "$a \n";print "$b \n";print "$c \n";print "$d \n";=cut##函数传递数组参数,改变数组的内容,打印数组内容my @array=(10,20);xxxx(\@array);print "@array \n";sub xxxx{my $copy=shift; foreach $item (@$copy){$item=$item*2;}  for $row ($copy) {print "@$row\n";}print "@$copy \n";}##hash变量声明,赋值,循环输出my %hHashinfo=(‘a‘=>,‘b‘=>2);my %hTableinfo=();### 读取记录数据while ( my @recs = $sth->fetchrow_array ) {$hTableinfo{ $recs[0] } = ( $recs[6] - $recs[3] ) / $recs[6];}foreach my $key ( keys %hTableinfo ) {my $value = $hTableinfo{$key}; }




This article is from the "day with it" blog, please be sure to keep this source http://raugher.blog.51cto.com/3472678/1561839

Common Perl syntax records

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.