Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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"; }

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: (12)
As of 2016-10-26 20:25 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (347 votes). Check out past polls.