>>>>> "MM" == Mike McClain <[email protected]> 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 ------ [email protected] -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/