>>>>> "MM" == Mike McClain <mike.j...@nethere.com> writes:

  MM> mike@/deb40a:~/perl> perl -we '
  MM> @list=qw/Perl is cool./;print( "list=\t", map { "$_," } @list, "\n");
  MM> '
  MM> list=   Perl,is,cool.,
  MM> ,mike@/deb40a:~/perl>

  MM> Could someone tell me why there is a comma printed after the newline?

because you put it there. the \n is input to the map, not the print!
map's last arg is a list and it takes @list AND anything else after
it. you need to either put the map in parens or make it a func like call
like this: map( "$_,", @list ) so it can't eat the \n.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to