Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Array to strings?

1,441 views
Skip to first unread message

gfs X

unread,
Mar 23, 2005, 4:34:53 AM3/23/05
to
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

unread,
Mar 23, 2005, 5:44:28 AM3/23/05
to
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

unread,
Mar 23, 2005, 8:34:17 PM3/23/05
to

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

0 new messages