perl 学习陆续记载

前端之家收集整理的这篇文章主要介绍了perl 学习陆续记载前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

perl标示符概览

本文主要对学习perl过程进行记载,方便后期学习

#!/usr/bin/perl
# This is a single line comment

print "Hello,world\n";

=begin comment
注释块,以=开始, 以=cut结束
This is all part of multiline comment.
You can use as many lines as you like
These comments will be ignored by the 
compiler until the next =cut is encountered.
=cut


1.双引号能解释当中引用的变量,单引号不会打印出变量值

2.\为escape特殊符号

3.perl标示符标示变量,方法名,类名,模块名和其他对象。perl标示符用$,@,%后接一个多多哥字符,下划线以及数字(0-9)


perl变量

perl为宽松类型语言,大致有三种类型1. 标量 $ 2. 数组@ 3 Hashes %

数字分为有符号整型态以及双精度浮点数,另外还有字符串,同时要注意字符串中的backslash的特殊字符,列表如下所示意

Escape sequence Meaning
\\ Backslash
\' Single quote
\" Double quote
\a Alert or bell
\b Backspace
\f Form Feed
\n Newline
\r Carriage return
\t Horizontal tab
\v Vertical tab
\0nn Creates Octal formatted numbers
\xnn Creates Hexideciamal formatted numbers
\cX Control characters,x may be any character
\u Force next character to uppercase
\l Force next character to lowercase
\U Force all following characters to uppercase
\L Force all following characters to lowercase
\Q Backslash all following non-alphanumeric characters
\E End \U,\L,or \Q

猜你在找的Perl相关文章