Google 網路論壇不再支援新的 Usenet 貼文或訂閱項目,但過往內容仍可供查看。

Array to strings?

瀏覽次數:1,441 次
跳到第一則未讀訊息

gfs X

未讀,
2005年3月23日 凌晨4:34:532005/3/23
收件者:
Hi, Im a complete noob to perl.
Is there a way to convert array values into a string?

For example

@myarr=("Sample","test","Array");
My desired output: "SampletestArray"
To then work with as a string.

I know I could just specify piece by piece but thats just too much and
very impractical (im using it to generate filenames)

Much thanks in advance

pingu

未讀,
2005年3月23日 清晨5:44:282005/3/23
收件者:
see

perldoc perlfunc
look for 'join'

$string = join('',@myarr)

FYI: this newsgroup is defunct. Try comp.lang.perl.misc in the future
for general Perl questions.

gfs X

未讀,
2005年3月23日 晚上8:34:172005/3/23
收件者:

Pingu, that worked perfectly, Thanks a lot! Ill be sure to move to the
other group if i have another question.

0 則新訊息