Perl程序用空格替换制表符 [英] Perl program to replace tabs with spaces

查看:168
本文介绍了Perl程序用空格替换制表符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想写一个Perl单行代码,用空格替换当前目录中一批文本文件中的所有制表符'\ t',并且不影响可见间距.

I'd like to write a Perl one-liner that replaces all tabs '\t' in a batch of text files in the current directory with spaces, with no effect on the visible spacing.

有人可以告诉我该怎么做吗?

Can anyone show me how to do this?

推荐答案

这位于或者您可以只使用Text::Tabs模块(标准Perl发行版的一部分).

Or you can just use the Text::Tabs module (part of the standard Perl distribution).

use Text::Tabs;
@expanded_lines = expand(@lines_with_tabs);

这篇关于Perl程序用空格替换制表符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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