avatar
c*o
1
Suppose I have text file like this:
sdfsdfsfsdf
sfdssdfdsfs
dddddd dddd
sdfsdfsasda
adsdddddddd
aa12345aaaa
aaaaaaaabbb
dddffffffff
If I want to put, say, the first 3 letters in one variable, next two in
another variable, next six in the third variable, of course, for each line,
how can I do that in perl?
Thanks,
avatar
c*r
2
substr

【在 c**o 的大作中提到】
: Suppose I have text file like this:
: sdfsdfsfsdf
: sfdssdfdsfs
: dddddd dddd
: sdfsdfsasda
: adsdddddddd
: aa12345aaaa
: aaaaaaaabbb
: dddffffffff
: If I want to put, say, the first 3 letters in one variable, next two in

avatar
A*o
3
/(.{3})(.{2})(.{4})/

【在 c**o 的大作中提到】
: Suppose I have text file like this:
: sdfsdfsfsdf
: sfdssdfdsfs
: dddddd dddd
: sdfsdfsasda
: adsdddddddd
: aa12345aaaa
: aaaaaaaabbb
: dddffffffff
: If I want to put, say, the first 3 letters in one variable, next two in

avatar
c*o
4
Thanks, this one works and is simply.

line,

【在 A*****o 的大作中提到】
: /(.{3})(.{2})(.{4})/
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。