split和join合写

小骆驼 第一章 简介
1.

// input 和截取字符
#!usr/bin/perl

use strict;
use warnings;



while ( <> )
{

chomp;

print join("\t",(split/:/)[0,2,1,5]),"\n";

}
// say = print+\n
#!/usr/bin/envperl

use 5.010;#指明版本号
use strict;
use warnings;



say "helloworld!";

print "helloworld!\n";
//将文件中的字段读入,修改,和输出
#!/usr/bin/perl

use strict;
use warnings;


my @lines = ` perldoc -u -fatan2 `;

foreach ( @lines )
{

s/ \w < ([^>]+) > / U$1 /g;

print;#这里不明白print的用法

}

尝试去写与上面print相同功能的代码段,失败了,不知道怎么修改

//想要print出PPLE
#!/usr/bin/envperl


use strict;
use warnings;

my $test = "apple";$test =~s/ a(\w)+ / \U$1 /g;

print;
原文地址:https://www.cnblogs.com/yuanjingnan/p/11061490.html