develooper Front page | perl.fwp | Postings from July 2001

Re: Sorting in-place

Thread Previous | Thread Next
From:
pcg
Date:
July 31, 2001 14:34
Subject:
Re: Sorting in-place
Message ID:
20010731233414.I10116@cerebro.laendle
On Tue, Jul 31, 2001 at 12:34:16PM -0700, Paul <ydbxmhc@yahoo.com> wrote:
> >     do {{EXPR; last}}
> > forces void context on EXPR.
> 
> 1) is the do{} necessary there?

Yes, because of the last. I think it's pretty unintuitive to having to
add the above uglyness around my last statement when I know it's the last
statement.

>    Wouldn't a block do by itself?

"do {}" *is* the block. A block inherits it's context. However, you can omit
the "do" for most standalone blocks.

>    i.e., wouldn't { EXPR } constitute void context?

It would have whatever context the block is in.

> 2) just for my own edification,
>    I assume this refers to Perl 5?

still, yes, perl5 + in-place-sort ;)

-- 
      -----==-                                             |
      ----==-- _                                           |
      ---==---(_)__  __ ____  __       Marc Lehmann      +--
      --==---/ / _ \/ // /\ \/ /       pcg@goof.com      |e|
      -=====/_/_//_/\_,_/ /_/\_\       XX11-RIPE         --+
    The choice of a GNU generation                       |
                                                         |

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About