由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Linux版 - perl $_ question
相关主题
Perl问题求助Debian 下用什么看中文?
find问题繁体字体问题。
idb problem (转载)LINUX下面的TERMINAL部分中文字无法显示
Help: cannot log all output/errors to file using 2>&1How to set Chinese font under UTF-8 encoding?
scp 选择性的转移某些文件,怎么操作?问题:关于python和web
Ubuntu 下 foreach(`ls -d xxx`) 不能workperl能不能一次把一个str中的a替换成x,b替换成y?
如何在bash里backup所有checkout的文件?any bash command option similar as perl -c to check the syn
how to enable Simplified Chinese input in ubuntu 9.04?Parrot VM 跑 perl python PHP Ruby 啥意思?
相关话题的讨论汇总
话题: var话题: print话题: question话题: perl话题: my
进入Linux版参与讨论
1 (共1页)
w*s
发帖数: 7227
1
my @cmd = `some cmds generate multiple lines of output`;
if($_ =~ /pattern/)
{
@var = split(/ /, $_);
foreach (@var)
{
print $_."\n"; # print all var in this line
}
}
my question is, if you look at the last $_,
can it work ?
j*a
发帖数: 14423
2
你没机器测试?

【在 w*s 的大作中提到】
: my @cmd = `some cmds generate multiple lines of output`;
: if($_ =~ /pattern/)
: {
: @var = split(/ /, $_);
: foreach (@var)
: {
: print $_."\n"; # print all var in this line
: }
: }
: my question is, if you look at the last $_,

G*******s
发帖数: 4956
3
写代码的人是猪头么?

【在 w*s 的大作中提到】
: my @cmd = `some cmds generate multiple lines of output`;
: if($_ =~ /pattern/)
: {
: @var = split(/ /, $_);
: foreach (@var)
: {
: print $_."\n"; # print all var in this line
: }
: }
: my question is, if you look at the last $_,

j*a
发帖数: 14423
4
:/tmp$ cat a.pl
$_ = "a b c d ef gh ij";
@var = split(/ /, $_);
foreach (@var)
{
print $_."\n"; # print all var in this line
}
:/tmp$ perl a.pl
a
b
c
d
ef
gh
ij

【在 w*s 的大作中提到】
: my @cmd = `some cmds generate multiple lines of output`;
: if($_ =~ /pattern/)
: {
: @var = split(/ /, $_);
: foreach (@var)
: {
: print $_."\n"; # print all var in this line
: }
: }
: my question is, if you look at the last $_,

w*s
发帖数: 7227
5
i simplified the non-working code and posted it here,
didn't test this one.
will debug tomorrow, thanks a lot!

【在 j*a 的大作中提到】
: :/tmp$ cat a.pl
: $_ = "a b c d ef gh ij";
: @var = split(/ /, $_);
: foreach (@var)
: {
: print $_."\n"; # print all var in this line
: }
: :/tmp$ perl a.pl
: a
: b

L*1
发帖数: 11537
6
Be careful with ` character, my friend. Try the follow code and you will
know what I meant.
my @output = `ls -l`;
print @output;

【在 w*s 的大作中提到】
: my @cmd = `some cmds generate multiple lines of output`;
: if($_ =~ /pattern/)
: {
: @var = split(/ /, $_);
: foreach (@var)
: {
: print $_."\n"; # print all var in this line
: }
: }
: my question is, if you look at the last $_,

1 (共1页)
进入Linux版参与讨论
相关主题
Parrot VM 跑 perl python PHP Ruby 啥意思?scp 选择性的转移某些文件,怎么操作?
这个perl的简单小程序为什么不work?Ubuntu 下 foreach(`ls -d xxx`) 不能work
网页如何马上更新呢如何在bash里backup所有checkout的文件?
问问应该学用那个shell?how to enable Simplified Chinese input in ubuntu 9.04?
Perl问题求助Debian 下用什么看中文?
find问题繁体字体问题。
idb problem (转载)LINUX下面的TERMINAL部分中文字无法显示
Help: cannot log all output/errors to file using 2>&1How to set Chinese font under UTF-8 encoding?
相关话题的讨论汇总
话题: var话题: print话题: question话题: perl话题: my