踹开Perl大门

Perl引号

2020-06-06  本文已影响0人  善良土豆

擦擦鞋,伸腿,准备开始踹开Perl大门

今天来个Perl引号

Perl引号
跟随命令敲起来
###双引号
$num = 5;
print "The number is $num.\n";
print "I need \$5.00.\n";
print "\t\tI can't help you.\n";


###单引号
print 'I need $100.00',"\n";
print 'The string literal, \t, is used to represent a tab.',"\n";
print 'She cried, "Help me!"',"\n";


###反引号
print "The date is ", `date`;
print "The date is `date`",".\n";
$directory = `pwd`;
print "\nThe current directory is $directory.";

####Perl引号替换符号
print 'She cried, "I can\'t help you!"',"\n";
print qq/She cried,"I can't help you!"/,"\n";
print qq(I need $5.00\n);
print q/I need $5.00\n/;
print qq(I need \$5.00\n);
print q!I need $5.00!,"\n";   #No output
print "The present workding directory is ", `pwd`;
print qq/Today is /, qx/date/;
print "The hour is ",qx{date +%H};
上一篇 下一篇

猜你喜欢

热点阅读