Re: Array to strings?

From: gfs X (booya_at_grandma.com)
Date: 03/24/05

  • Next message: Dima: "Why not work POSIX::RT:Semaphore"
    Date: Thu, 24 Mar 2005 01:34:17 GMT
    
    

    On 2005-03-23 05:44:28 -0500, pingu <pingu@work.bcol.be> said:

    > gfs X wrote:
    >> 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.

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


  • Next message: Dima: "Why not work POSIX::RT:Semaphore"

    Relevant Pages

    • Re: String.split() -- If Last String is Empty?
      ... I'll get an array with 3 elements. ... data that is used by both Perl and Java programs. ... If I split the same string ...
      (comp.lang.java.help)
    • Re: String.split() -- If Last String is Empty?
      ... I'll get an array with 3 elements. ... data that is used by both Perl and Java programs. ... string in Perl, I'll get 4 elements in an array with the last one being ...
      (comp.lang.java.help)
    • String.split() -- If Last String is Empty?
      ... I'll get an array with 3 elements. ... data that is used by both Perl and Java programs. ... If I split the same string ...
      (comp.lang.java.help)
    • A Beginners problem
      ... couple of books, including _Beginning Perl_ and _Picking Up Perl_, to ... print CONTROL2 "Names: $names"; ... fill the array with the string of names. ...
      (perl.beginners)
    • String parsing?
      ... I am new to ruby but have an okay background in perl. ... I would like the array to look like this: ... I might see if there is an elegant way to parse this string using tokens. ...
      (comp.lang.ruby)