本文概述
- Perl显示电子邮件地址
- Perl $符号嵌入双引号字符串
- Perl转义转义字符
- Perl转义双引号
- Perl Double-q运算符q
- Perl单q运算符, q
Perl显示电子邮件地址所有电子邮件地址都包含(@)符号。如前所述, 符号通常不会在字符串内打印。他们需要特别注意。 @符号前使用反斜杠(\)来打印电子邮件地址。
use strict;
use warnings;
my $site= "srcmini\@gmail.com";
print "$site\n";
输出
srcmini@gmail.com
Perl $符号嵌入双引号字符串如果要在字符串中打印($)符号, 请在$符号前面使用反斜杠(\)。
use strict;
use warnings;
my $msg1 = 'Ana';
print "We have defined \$msg1 as $msg1\n";
输出
We have defined $msg1 as Ana
Perl转义转义字符如果要在字符串中打印(\)符号, 请在\符号前面使用反斜杠(\)。
use strict;
use warnings;
print "The \\n is a new line chracter in programming languages.\n";
输出
Everyone has to follow this rule whether its a boy\girl
Perl转义双引号如果要在字符串中打印双引号, 请在两个引号处都使用反斜杠(\)。
use strict;
use warnings;
my $x = 'tutorials';
print "Our site \"srcmini\" provides all type of \"$x\"\n";
输出
Our site "srcmini" provides all type of "tutorials?
Perl Double-q运算符q” qq” 运算符用括号将字符串周围的双引号替换。这意味着(“ ” )在此字符串上不再是必需的。它只会用qq打印字符串。
但是, 如果你想在字符串中使用方括号, 则需要在字符串周围使用大括号{}。
【Perl字符串转义字符】而且, 如果你需要在字符串内使用花括号, 请在字符串周围使用方括号[]。
#use of qquse strict;
use warnings;
my $x = 'tutorials';
print qq(Our site "srcmini" provides all type of "$x"\n);
#use of {} bracketsprint qq{Our site (srcmini) provides all type of "$x"\n};
#use of [] bracketsprint qq[Our site (srcmini} provides all type of "$x"\n];
输出
Our site "srcmini" provides all type of "tutorials"Our site (srcmini) provides all type of "tutorials"Our site (srcmini} provides all type of "tutorial"
Perl单q运算符, q单个” q” 运算符用作字符串中的单引号(‘ )。像单引号一样, 它也不插入变量。
#use of quse strict;
use warnings;
my $x = 'tutorials';
print q(Our site "srcmini" provides all type of "$x"\n);
print"\n";
#use of () bracketsprint q(Our site "srcmini" provides all type of "$x"\n);
print"\n";
#use of {} bracketsprint q{Our site )srcmini( provides all type of "$x"\n};
print"\n";
#use of {} bracketsprint q[Our site )srcmini} provides all type of "$x"\n];
输出
Our site "srcmini" provides all type of "$x"\nOur site "srcmini" provides all type of "$x" \nOur site )srcmini( provides all type of "$x" \nOur site )srcmini} provides all type of "$x" \n
推荐阅读
- Perl Switch语句
- Perl字符串用法
- Perl安装详细步骤
- Perl STDIN用法
- AndroidP推出多项AI功能,会不会引发新的隐私担忧()
- Android自定义View之上拉下拉列表 头部元素跟随 缩放平移效果的实现
- AppiumDriverLocalService 启动appium控制台不显示日志以及把日志保存到本地
- 20165324 Java实验四 Android程序设计
- Android Studio运行出现项目 错误(非法字符:“ufeff”)