问:这有什么问题? [英] Q: What's wrong with this?

查看:94
本文介绍了问:这有什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




这与我以前的帖子有关,但我让它更简单......


open(INFILE,& ; test.txt");

while(<>){

print $ _;

s / one / two / g;

打印$ _;

}


我现在真的想不到 - 为什么test.txt的内容不是

改变了吗?

打印$ _输出给我

一个

两个

一个

两个


但是cat test.txt仍然是:

one

one
>

谢谢

Hi,

This is related to my previous post but I made it much simpler...

open (INFILE, "test.txt");
while (<>) {
print $_;
s/one/two/g;
print $_;
}

I really cannot think now - why are the contents of test.txt not being
changed?
print$_ output gives me
one
two
one
two

but cat test.txt is still:
one
one

Thanks

推荐答案

_;

s / one / two / g;

print
_;
s/one/two/g;
print


_;

}


我现在真的想不起 - 为什么test.txt的内容没有被改变?
改变了?

print
_;
}

I really cannot think now - why are the contents of test.txt not being
changed?
print


_输出给了我

一个

两个

一个

两个


但是cat test.txt仍然是:

one br />
一个


谢谢
_ output gives me
one
two
one
two

but cat test.txt is still:
one
one

Thanks


这篇关于问:这有什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆