Re: Array to strings?

From: pingu (pingu_at_work.bcol.be)
Date: 03/23/05

  • Next message: gfs X: "Re: Array to strings?"
    Date: Wed, 23 Mar 2005 11:44:28 +0100
    
    

    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.


  • Next message: gfs X: "Re: Array to strings?"

    Relevant Pages

    • Cant Compiling perl5.8.8 on FreeBSD6.2
      ... WITH_DEBUGGING=yes Build perl with debugging support. ... First let's make sure your kit is complete. ... What is the file extension used for shared libraries? ... I'll use sprintf to convert floats into a string. ...
      (comp.unix.bsd.freebsd.misc)
    • Re: use of DBI; I am getting multiple error messages mixed in with ?the correct output.
      ... But I'm not talking about C++ or Java or SQL. ... This is a perl newsgroup. ... to means by a "defined null string", as opposed to an undefined value. ... And where exactly are you getting the idea that the empty string is a ...
      (comp.lang.perl.misc)
    • 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)
    • Re: Perl Strings vs FileHandle
      ... Just wanted to run this through Perl gurus to see if fit is ... testing it every time through the loop. ... The comparison test to the string '1' is superfluous. ... Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers ...
      (comp.lang.perl.misc)