Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Join and Concatenation

by ricDeez (Scribe)
on Sep 14, 2013 at 00:53 UTC ( #1054035=note: print w/ replies, xml ) Need Help??

in reply to Join and Concatenation

As has already been stated this is related to operator precedence, with the parenthesis forcing order and returning the results you want. However you can avoid using join altogether if you modify the $" internal variable. In my opinion, this is cleaner and even obviates the need for an intermediate variable.

This is what I am thinking:

#!/usr/bin/perl use strict; use warnings; my @array = qw( a b c ); { local $" = '],['; print "[@array]\n"; }

Comment on Re: Join and Concatenation
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1054035]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2015-12-01 01:52 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (791 votes), past polls