用空格拆分数字并存储在单个变量中

用空格拆分数字并存储在单个变量中

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

问题描述

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";

推荐答案






我的尝试:





What I have tried:



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

09-05 23:11