http://www.perlmonks.org?node_id=13827


in reply to RE: Re: script adding spaces into a file for no reason...
in thread script adding spaces into a file for no reason...

My solution, @{[join("",@text)]} does not return an array in this case. (Look at pg.239-241 of Effective Perl Programming for more examples of using this construct). It does use the anonymous array construct and the array dereferencing construct, but the net result is to interpret the code inside the brackets in whatever context it would have occured elsewhere outside of the constuct and the here-doc. So, because "join" returns a scalar, so does my code. It's just a quick and dirty way to interpolate a piece of code inside a larger print statement.

Of course, there are many other ways you could accomplish the same thing, I just happen to like this because it keeps the amount of variable assignment to a minimum.