perl chop和chomp函数
来源:互联网 发布:2016开淘宝店卖什么 编辑:程序博客网 时间:2024/05/15 23:01
chop(str) 截去最后一个字符,无论是什么字符chomp(str) 截去末尾的行分割符(\n),行分割符可由$/定义。[oracle@jhoa bobooke]$ cat 2.pl #!/usr/bin/perl$a="abcd\n";#chop($a);print "chop $a";[oracle@jhoa bobooke]$ perl 2.pl chop abcd[oracle@jhoa bobooke]$ cat 2.pl #!/usr/bin/perl$a="abcd\n";chop($a); ##此时回车符会被截去print "chop $a";[oracle@jhoa bobooke]$ perl 2.pl chop abcd[oracle@jhoa bobooke]$ [oracle@jhoa bobooke]$ cat 3.pl #!/usr/bin/perl$a="abcd\n";chomp($a);print "chomp $a";[oracle@jhoa bobooke]$ perl 3.pl chomp abcd[oracle@jhoa bobooke]$
[oracle@jhoa perl]$ cat a2.pl $text = "a line of text\n";print "\$text is $text";chomp($text);print "\$text is $text";[oracle@jhoa perl]$ perl a2.pl $text is a line of text$text is a line of text[oracle@jhoa perl]$
0 0
- perl chop和chomp函数
- Perl中chomp和chop
- Perl中chomp函数和chop函数的区别
- Perl中chomp和chop的区别
- Perl中chomp和chop的区别
- chop() vs. chomp() of Perl
- chomp和chop用法
- Perl中chomp和chop的区别介绍
- Ruby中的chop和chomp
- perl函数说明(chop)
- Ruby中的chop和chomp用法辨析
- [Perl]chomp 和 $/
- chomp 与chop
- chomp 跟 chop
- Perl chomp
- 用C++语言实现perl中的chomp函数
- Perl chomp 操作
- Perl chomp使用
- 链表反转
- Construct Binary Tree from Preorder and Inorder Traversal
- Sublime Text 2 介紹
- [AC自动机+概率dp] hdu 3689 Infinite monkey theorem
- ubuntu /etc/profile文件
- perl chop和chomp函数
- Machine Learning Foundations q15
- iOS-UICollectionView的使用简介
- apk反编译查看*.java,AndroidManifest.xml,布局xml文件
- 【C++】typedef与define的思考
- C# 6.0 (C# vNext) 新功能之:Expression Bodied Functions and Properties
- 大数据量索引分析
- ubuntu设置DNS
- MIPS CPU 50%的动态功耗