Start learning Perl scripts,record some useful Perl functions here.
- Int()
Function int() can return a integer from a float value.
[user@host perl]$ perl -e "print int(1.6)"
1[user@host perl]$ perl -e "print int(2.6)"
2[user@host perl]$
- Rand()
Function rand() can return a radon value between 0 and a certain integer.
[user@host perl]$ perl -e "print int(rand(20))"
5[user@host perl]$
perl -e "print int(rand(20))"
7[user@host perl]$ perl -e "print int(rand(20))"
15[user@host perl]$
perl -e "print int(rand(20))"
7[user@host perl]$
- Chr()
Function chr() can return a character of keyboard from a number.
[user@host perl]$
perl -e "print chr(48)"
0[user@host perl]$
perl -e "print chr(43)"
+ [user@host perl]$
perl -e "print chr(37)"
%[user@host perl]$
These are simple functions,I’ll collect more in future. I always remember the sentence “Thousands of miles are beginning form our feet!”
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。