Re: Search and Replace



Chas Owens wrote:

On 7/14/07, Mr. Shawn H. Corey <shawnhcorey@xxxxxxxx> wrote:

Chas Owens wrote:

By the way, an easier way to write the join version is

print map { "$_\n" } @list;


BTW, that's not the same. Join inserts its string between each element,
map (in this case) appends it to the end. A subtle difference that may
lead to confusion and errors.
snip

The code I am referring to is

print +(join "\n", @LIST), "\n" ;

Which does the same thing as

print map { "$_\n" } @list;

The only difference between them is if $, is set.

No it doesn't. As Shawn said, the join doesn't append a newline
after the last element.

Rob
.



Relevant Pages

  • Re: Search and Replace
    ... >> map appends it to the end. ... A subtle difference that may ... >> lead to confusion and errors. ... the join function is not the right function to use here. ...
    (perl.beginners)
  • Re: Error "The operation was canceled by the user"
    ... a subtle difference between it and the other three example I showed. ... permission level of the batch procedure to "runas administrator", ... didn't even think there was more than the single user context - I ...
    (microsoft.public.scripting.vbscript)
  • Re: Search and Replace
    ... map appends it to the end. ... A subtle difference that may ... lead to confusion and errors. ...
    (perl.beginners)
  • Re: Great SWT Program
    ... you have a distorted view of the world" into "you hallucinate" ... But there's also a subtle difference of kind -- "you ... illness of any kind; I'm not sure I can honestly claim to have ...
    (comp.lang.java.programmer)
  • Re: SImple, easy, secure and cheap database solution for website?
    ... Those appear to be documents about what you need to achieve, NOT how to achieve it, a subtle difference that you don't seem to understand. ... Hyde Park and 'speakers corner'... ... mail to this address goes unread. ...
    (uk.net.web.authoring)