用空格拆分数字并存储在单个变量中 [英] Splitting the numbers by a space and storing in single variable

查看:86
本文介绍了用空格拆分数字并存储在单个变量中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

16.726--5.670--25.129**16.312--5.718--22.847**14.366--5.258--25.545**16.920--3.457--25.425**19.419--6.712--25.198**18.536--7.602--25.240**19.152--5.518--24.957**15.501--7.808--24.644**16.883--6.024--27.528**

I have to split the numbers. Remove those ** and -- between numbers and store in single variable( $points ). I have to do this in perl. i have provided the code till removing of ** between the numbers.

output of $points  : 16.726 5.670 25.129 16.312 5.718 22.847 14.366 5.258 25.545 16.920 3.457 25.425 19.419 6.712 25.198 18.536 7.602 25.240 19.152 5.518 24.957 15.501 7.808 24.644 16.883 6.024 27.528

Thanks in advance.





我的尝试:





What I have tried:

$points = "16.726--5.670--25.129**16.312--5.718--22.847**14.366--5.258--25.545**16.920--3.457--25.425**19.419--6.712--25.198**18.536--7.602--25.240**19.152--5.518--24.957**15.501--7.808--24.644**16.883--6.024--27.528**";
@pointss = split(/\*\*/,$points);
print "@pointss\n";

推荐答案

points)。我必须在perl中这样做。我提供了代码,直到删除数字之间的**。

输出
points ). I have to do this in perl. i have provided the code till removing of ** between the numbers. output of


积分:16.726 5.670 25.129 16.312 5.718 22.847 14.366 5.258 25.545 16.920 3.457 25.425 19.419 6.712 25.198 18.536 7.602 25.240 19.152 5.518 24.957 15.501 7.808 24.644 16.883 6.024 27.528

提前致谢。
points : 16.726 5.670 25.129 16.312 5.718 22.847 14.366 5.258 25.545 16.920 3.457 25.425 19.419 6.712 25.198 18.536 7.602 25.240 19.152 5.518 24.957 15.501 7.808 24.644 16.883 6.024 27.528 Thanks in advance.





我的尝试:





What I have tried:


points =16.726--5.670--25.129 ** 16.312--5.718--22.847 * * 14.366--5.258--25.545 ** ** 16.920--3.457--25.425 ** 19.419--6.712--25.198 ** 18.536--7.602--25.240 ** 19.152--5.518--24.957 15.501--7.808 --24.644 ** 16.883--6.024--27.528 **;
@pointss = split(/ \ * \ * /,
points = "16.726--5.670--25.129**16.312--5.718--22.847**14.366--5.258--25.545**16.920--3.457--25.425**19.419--6.712--25.198**18.536--7.602--25.240**19.152--5.518--24.957**15.501--7.808--24.644**16.883--6.024--27.528**"; @pointss = split(/\*\*/,


这篇关于用空格拆分数字并存储在单个变量中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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