本文介绍了PERL中的字符串到字符数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是PERL的初学者。陷入困境试图弄清楚字符串如何转换为字符数组。


for ex:我想将@ str1 =(" apple")转换为charcter数组,例如

@ chr1 =(''a'' ,''p'',''p'','''',''e'')


有人可以帮助我实现上述方法吗?

我基本上需要从用户那里得到一个字符串,并解决该字符串的每个字符(字母)。好吧,iam在我的任务中...所以任何人的快速回复都表示赞赏。


问候,

bhanumathy。

解决方案




很久以前在Perl中实现了这样做的功能。到RTFM的时间?



hi, I am a beginer in PERL. got stuck in trying to figure out how strings are converted to character arrays.

for ex: I want to convert @str1=("apple") to a charcter array like
@chr1=(''a'',''p'',''p'',''l'',''e'')

can some one help me how to implement the above?
I basically need to get a string form the user and address each character(letter) of that string. well, iam in the middle of my assignment...so a quick reply from any one is appreciated.

regards,
bhanumathy.

解决方案


A function for doing that was implemented in Perl a long time ago. Time to RTFM?



这篇关于PERL中的字符串到字符数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 08:32
查看更多