Array to strings?

G

gfs X

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
 
P

pingu

gfs said:
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
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.
 
G

gfs X

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.

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top