On Sat, Nov 13, 2010 at 05:43:21AM -0500, Uri Guttman wrote:
> > "MM" == Mike McClain writes:
> 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
> "MM" == Mike McClain 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?
becau
mike@/deb40a:~/perl> perl -v
This is perl, v5.8.8 built for i486-linux-gnu-thread-multi
mike@/deb40a:~/perl> perl -we '
@list=qw/Perl is cool./;print( "list=\t", map { "$_," } @list, "\n");
'
list= Perl,is,cool.,
,mike@/deb40a:~/perl>
Could someone tell me why there is a comma printed after the
--- [EMAIL PROTECTED] wrote:
> context". How do you evaluate a block in scalar context? Any light on
> this ( or a pointer ) maybe?
print { *STDOUT } "foo\n";
This is looking at the block to return the filehandle to which the
output should go. Surely that argument is in a scalar context, sep
At 11:40 AM 6/13/01 -0500, [EMAIL PROTECTED] wrote:
>How do you evaluate a block in scalar context? Any light on this
>( or a pointer ) maybe?
$ perl -le 'do { print wantarray ? "LIST" : "SCALAR" }'
SCALAR
perlfunc should mention this under 'do', perhaps...
--
Peter Scott
Pacific Systems Design
Dave> Well it's quite simple actually. A BLOCK of Perl code is a BLOCK of
Perl code.
Dave> No matter where you put it. Typically anything inside a set of {}'s
is a block
Dave> of code. So the fact that a subroutine consists of a block of code
Dave>
Dave> sub foo { BLOCK }
Dave>
Dave> and ma
On Fri, 8 Jun 2001 [EMAIL PROTECTED] wrote:
> Gurus,
> perldoc -f map says,
>
>
>-
> map BLOCK LIST
> map EXPR,LIST
> Evaluates the BLOCK or EXPR for each ele
Gurus,
perldoc -f map says,
-
map BLOCK LIST
map EXPR,LIST
Evaluates the BLOCK or EXPR for each element of LIST
(locally setting `$_' to each element