s_gaurav1091 has asked for the wisdom of the Perl Monks concerning the following question:

suppose i have got a array like my @array = ("first","second","third"); and now i want that my output of array should be such that there is a space of two tabs between each elements

Retitled by g0n from 'arrays'.

Replies are listed 'Best First'.
Re: Joining an array with two tabs
by cog (Parson) on Jul 18, 2005 at 09:37 UTC
    You can use the special variable $, to do that:

    $, = "\t\t"; print @array;

    See perldoc perlvar and search for $, to see an explanation of what it does. See also $".

    HTH

      You may want to do 'local $, = "\t\t";'. Probably not a big deal on this one, but I try to always use local when I reassign a global.
Re: Joining an array with two tabs
by monarch (Priest) on Jul 18, 2005 at 09:39 UTC
    You can also
    my @array = ("first","second","third"); my $output = join( "\t\t", @array ); print( $output );
      OT:
      monarch (and cog): why do you reply to this node, but not aprove it? That comfuses me. Apparently you aprove of the question, because you give an answer...

      Paul

        Personally, I try to do only one of the following:

        • Reply
        • Approve
        • Front-page

        This prevents me from messing up :-) I'm pretty sure that if the node is a good one the next person coming up will approve it :-)