Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (10)
As of 2014-09-19 21:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (147 votes), past polls