Paul wrote:
> >     do {
> >         my $empty;
> >         $empty ++;
> >     };
>
> Also, the do() is superfluous here, isn't it?
> It invokes some overhead (unless the optimizer squashes it out, which
> I suspect....)
>
> Of course, the whole block is superfluous.
> It's an expensive no-op, like saying undef(); on a line by itself, but
> doing more work.
>
> Am I missing something here? Feeling dense. :P

No, the 'do' is superfluous, as is the block. In the end, Perl
itself is superfluous, as are we programmers...

I was trying to show something that would return a value in
the same way as a subroutine block (so that I didn't need a
return statement in the same way as a subroutine doesn't).
I started out with a bare block, but realised that it needed
a 'do' to have a value, and therefore make it non-redundant
in context.

i.e. wherever you put that bare block it would be redundant,
but if you put the do { .. } in an expression it becomes useful.

See? I'm not sure I do!

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to