问题描述
36985 arrunav 25871 elarital 48734 depaal 43212 sujan 23467 我的数据是这种形式我需要在perl脚本中用逗号替换空格,而不是如何编写上述数据的代码 我的数据输出应该是arun,36985 arrunav,25871 elarital,48734 depaal,43212 sujan,23467 解决方案例如,请参阅: SEARCH&替换 [ ^ ]。 例如
s = arun 36985;
s =〜s / /,/; print
arun 36985
arrunav 25871
elarital 48734
depaal 43212
sujan 23467
my data is in this form i need to replace space with comma in perl script than how can i write the code for the above data
my data out put should be arun,36985
arrunav,25871
elarital,48734
depaal,43212
sujan,23467
解决方案 See, for instance, here: SEARCH & REPLACE[^].
e.g.
s = "arun 36985";
s =~ s/ /,/;
print