Perl学习(十一)——大总结基本内容

来源:互联网 发布:yy踢人软件 编辑:程序博客网 时间:2024/06/05 04:06

Perl学习(十一)——大总结基本内容

对于Perl的基本使用,下面是一个例子程序包含了输入、输出、字符串连接等的使用:

#!/usr/bin/perl -wprint "hello world\n";print "hello 就是我"."ccccc\n";print "aa","bb","cc","\n";print "jiji" x 3;print "\n";$what = "aacd";print $what."\n";print "123${what}4646\n";print " " eq " ";print "\n";print 12 eq 12.0;print "\n";if($what eq "aaccdd"){    print " \$what is aaccdd";}else{    print "cccccccc";}print "\n";print "清输入内容:";$line = chomp($line = <STDIN>); #chomp去掉最后的空格print "输入的内容是: $line";print "\n";if(defined($ccb)){    print " \$ccb has defined\n";}else{    print " \$ccb has not been defined\n";}

运行结果:

0 0
原创粉丝点击