develooper Front page | perl.perl5.porters | Postings from April 2001

Re: last() dynamically scoped?

Thread Previous | Thread Next
From:
Mark-Jason Dominus
Date:
April 12, 2001 13:00
Subject:
Re: last() dynamically scoped?
Message ID:
20010412200213.9823.qmail@plover.com

The discussion I remembered was from clp.moderated, not from p5p.
I am enclosing it.  Some of it is germane, and some is totally irrelevant.

Ronald was not the only person confused by the documentation.  (See
the posts from tgy@chocobo.org, below.)  Perhaps someone will
contribute a doc patch.

------- Forwarded Messages

Forwarded: Thu, 02 Mar 2000 15:34:43 -0500
Delivered-To: clpm@lists.eyrie.org
To: clpm@lists.eyrie.org
From: "Stephen Gertsch" <sgertsch@slip.net>
Newsgroups: comp.lang.perl.moderated
Subject: Why can a next within subroutine influence code outside the subroutine? 
Date: Sun, 27 Feb 2000 16:28:56 -0800
Organization: Posted via Supernews, http://www.supernews.com
Message-ID: <sbjgsqbojp150@corp.supernews.com>
X-Complaints-To: newsabuse@supernews.com
X-Priority: 3
X-Msmail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-Mimeole: Produced By Microsoft MimeOLE V5.00.2919.6600
Sender: clpm-owner@lists.eyrie.org
Precedence: bulk

I do not understand why perl allows the use of 'next' outside the context
block to which it pertains. Consider the following code fragment:

while($i++<5)
{
 print "Before sub call i=$i\n";
 &XXX;
 print "After sub call i=$i\n";
}

sub XXX
{
 next;
}

It appears to me that perl subroutines behave more like macros than
subroutines. If it is not already obvious, I am new to perl and feel that I
am missing an important philosophical point. Would someone care to enlighten
me?

------- Message 2

Forwarded: Thu, 02 Mar 2000 15:34:43 -0500
Delivered-To: clpm@lists.eyrie.org
To: clpm@lists.eyrie.org
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Newsgroups: comp.lang.perl.moderated
Subject: Re: Why can a next within subroutine influence code outside the subroutine?
References: <sbjgsqbojp150@corp.supernews.com>
Organization: Commercial Dynamics Pty Ltd, N.S.W., Australia
Reply-To: mgjv@comdyn.com.au
Mail-Copies-To: nobody
Message-ID: <slrn8bjrca.nb.mgjv@verbruggen.comdyn.com.au>
X-Newsreader: slrn (0.9.6.2 Linux)
Date: Mon, 28 Feb 2000 03:37:50 GMT
X-Complaints-To: abuse@telstra.net
X-Trace: nsw.nnrp.telstra.net 951709070 203.30.80.34 (Mon, 28 Feb 2000 14:37:50 EST)
NNTP-Posting-Date: Mon, 28 Feb 2000 14:37:50 EST
X-Original-NNTP-Posting-Host: 203.30.80.34
Sender: clpm-owner@lists.eyrie.org
Precedence: bulk

On Sun, 27 Feb 2000 16:28:56 -0800,
	Stephen Gertsch <sgertsch@slip.net> wrote:
> I do not understand why perl allows the use of 'next' outside the context
> block to which it pertains. Consider the following code fragment:
> 
> while($i++<5)
> {
>  print "Before sub call i=$i\n";
>  &XXX;
>  print "After sub call i=$i\n";
> }
> 
> sub XXX
> {
>  next;
> }

Have you tried this with the -w flag?

> It appears to me that perl subroutines behave more like macros than
> subroutines. If it is not already obvious, I am new to perl and feel that I
> am missing an important philosophical point. Would someone care to enlighten
> me?

Well.. One way to look at this, and I would insist the correct way if
Perl was a formal language, is that you are invoking undefined
behaviour. 

# perldoc -f next
[snip]
C<next> cannot be used to exit a block which returns a value such as
C<eval {}>, C<sub {}> or C<do {}>, and should not be used to exit
a grep() or map() operation.
[snip]

By doing this anyway, you basically are at the mercy of the
implementation, which is what 'undefined' means. As they say over in
comp.lang.c; daemons might fly out of your nose.

Since there is only one implementation of the language Perl, this may
be too strict an interpretation. However, you are doing something that
is documented not to be useful, and not to work, so what results is
undefined. The current behaviour in this case probably isn't even
guaranteed to stay.

Avoid doing what you do.

Martien

PS. Maybe perl should be more fascist, and catch this as an error. But
the fact that the warning exists should tip you off not to do it.

- -- 
Martien Verbruggen                      |
Interactive Media Division              | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |

------- Message 3

Forwarded: Thu, 02 Mar 2000 15:34:43 -0500
Delivered-To: clpm@lists.eyrie.org
Message-ID: <20000228161352.9416.qmail@windlord.stanford.edu>
From: Mike Giroux <rmgiroux@jemmcop.com>
To: clpm@lists.eyrie.org
Subject: RE: Why can a next within subroutine influence code outside the s
	ubroutine? 
Date: Mon, 28 Feb 2000 09:18:15 -0500
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2448.0)
Content-Type: text/plain;
	charset="iso-8859-1"
Newsgroups: comp.lang.perl.moderated
X-Original-Message-ID: <D068A1DFA6BFD31184F80050040685E0FC82@bdc>
Sender: clpm-owner@lists.eyrie.org
Precedence: bulk

Stephen Gertsch <sgertsch@slip.net> wrote:
> I do not understand why perl allows the use of 'next' outside 
> the context
> block to which it pertains. Consider the following code fragment:
> 
> while($i++<5)
> {
>  print "Before sub call i=$i\n";
>  &XXX;
>  print "After sub call i=$i\n";
> }
> 
> sub XXX
> {
>  next;
> }
> 
> It appears to me that perl subroutines behave more like macros than
> subroutines. If it is not already obvious, I am new to perl 
> and feel that I
> am missing an important philosophical point. Would someone 
> care to enlighten
> me?
> 


The quick summary of this long post: I don't know why it happens, it
certainly
happens, it's dangerous, and always use -w :)


The long version:

I couldn't believe this post, so I had to play around with this.  Sure
enough, 
Stephen is right.

Using this test code:
  #!/usr/local/bin/perl 

  while($i++<5)
  {
   print "Before sub call i=$i\n";
   &XXX;
   print "After sub call i=$i\n";
  }

  sub XXX
  {
   next;
  }

Here's what we get:
~$ perl -w test_goto.pl
Before sub call i=1
Exiting subroutine via next at test_goto.pl line 12.
(4 more times, incrementing i)

The Camel (2nd Edition) is no help; it just says (pg 573)
that 

(W) You are exiting a subroutine by unconventional means, such as a goto,
or a loop control statement.

What stuns me is that the next actually works.  So I'm guessing that a
misplaced next 
in a module or nested sub could really mess you up.  Testing the concept:


	#!/usr/local/bin/perl 

	use strict;

	sub XXX
	{
	 print "\tbefore next in sub\n";
	 next;
	 print "\tafter next in sub\n";
	}

	sub XX1
	{
		my $sub='XX1';
		print "$sub in\n";
		XXX;
		print "$sub out\n";
	}

	sub XX2
	{
		my $sub='XX2';
		print "$sub in\n";
		XX1;
		print "$sub out\n";
	}

	my $i;

	while($i++<5)
	{
	 print "Before sub call i=$i\n";
	 XX2;
	 print "After sub call i=$i\n";
	}

Running this confirms that yes, the next in XXX exits all the way back to
the loop :((

Putting 'package A;' before XXX and 'package main;' after it shows that
this'll work
even from a package.

"Happily", calling XX2 outside of a loop gets you this error:

Can't "next" outside a block at test_goto.pl line 10.

even if -w isn't used.

Otherwise, you're not going to see any warning at all unless you use -w.

Ugly.
- -- 
Mike

------- Message 4

Forwarded: Thu, 02 Mar 2000 15:34:43 -0500
Delivered-To: clpm@lists.eyrie.org
To: clpm@lists.eyrie.org
Message-ID: <38BAF83B.60647F4C@dont.spam.me.or.ill.be.mad.us>
Date: Mon, 28 Feb 2000 14:35:39 -0800
From: "Chris Hostetter \(The Hoss Man\)" <nospam@dont.spam.me.or.ill.be.mad.us>
Organization: chrish <at> cnet <dot> com
X-Mailer: Mozilla 4.5 [en] (Win95; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.lang.perl.moderated
Subject: Re: Why can a next within subroutine influence code outside the 
 subroutine?
References: <89e6s0$s60$1@nntp.Stanford.EDU>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: nntp1.ba.best.com 951777569 223 204.162.86.225
X-Unverified-Address: yes
X-Original-NNTP-Posting-Host: 204.162.86.225
Sender: clpm-owner@lists.eyrie.org
Precedence: bulk

Mike Giroux wrote:

> The Camel (2nd Edition) is no help; it just says (pg 573)
> that
> 
> (W) You are exiting a subroutine by unconventional means, such as a goto,
> or a loop control statement.
> 
> What stuns me is that the next actually works.  So I'm guessing that a
> misplaced next
> in a module or nested sub could really mess you up.  Testing the concept:

Acctually, this behaviour is well documented in the man pages...

legoland:~> perl -v

This is perl, version 5.004_04 built for sun4-solaris

Copyright 1987-1997, Larry Wall

Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5.0 source
kit.

legoland:~> perldoc perlsyn | grep -3 "innermost enclosing loop"

     the loop for the loop control statements next, last, and
     redo.  If the LABEL is omitted, the loop control statement
     refers to the innermost enclosing loop.  This may include
     dynamically looking back your call-stack at run time to find
     the LABEL.  Such desperate behavior triggers a warning if
     you use the -w flag.

------- Message 5

Forwarded: Thu, 02 Mar 2000 15:34:44 -0500
Delivered-To: clpm@lists.eyrie.org
To: clpm@lists.eyrie.org
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Newsgroups: comp.lang.perl.moderated
Subject: Re: Why can a next within subroutine influence code outside the s ubroutine?
References: <89e6s0$s60$1@nntp.Stanford.EDU>
Organization: Commercial Dynamics Pty Ltd, N.S.W., Australia
Reply-To: mgjv@comdyn.com.au
Mail-Copies-To: nobody
Message-ID: <slrn8bm39i.nb.mgjv@verbruggen.comdyn.com.au>
X-Newsreader: slrn (0.9.6.2 Linux)
Date: Tue, 29 Feb 2000 00:05:10 GMT
X-Complaints-To: abuse@telstra.net
X-Trace: nsw.nnrp.telstra.net 951782710 203.30.80.34 (Tue, 29 Feb 2000 11:05:10 EST)
NNTP-Posting-Date: Tue, 29 Feb 2000 11:05:10 EST
X-Original-NNTP-Posting-Host: 203.30.80.34
Sender: clpm-owner@lists.eyrie.org
Precedence: bulk

On Mon, 28 Feb 2000 09:18:15 -0500,
	Mike Giroux <rmgiroux@jemmcop.com> wrote:
> Stephen Gertsch <sgertsch@slip.net> wrote:
>
> > I do not understand why perl allows the use of 'next' outside the
> > context block to which it pertains. Consider the following code
> > fragment:
> 
> The quick summary of this long post: I don't know why it happens, it
> certainly happens, it's dangerous, and always use -w :)
[snip]
> Ugly.

[See also my other post]

Ugly, yes. But I really think it doesn't matter. By doing this, you do
something that is documented not to work, without defining what will
happen if you do it anyway. In this particular version of perl, the
next propagates up, or something like that. The next one may fail with
a fatal error. Another one may cause your computer to sprout wings and
fly out of the window.

It's just as ugly as what may happen if you do something undefined in
any other programming language.

Martien
- -- 
Martien Verbruggen              | 
Interactive Media Division      | 42.6% of statistics is made up on the
Commercial Dynamics Pty. Ltd.   | spot.
NSW, Australia                  | 

------- Message 6

Forwarded: Thu, 02 Mar 2000 15:34:44 -0500
Delivered-To: clpm@lists.eyrie.org
To: clpm@lists.eyrie.org
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Newsgroups: comp.lang.perl.moderated
Subject: Re: Why can a next within subroutine influence code outside the  subroutine?
References: <89e6s0$s60$1@nntp.Stanford.EDU> <38BAF83B.60647F4C@dont.spam.me.or.ill.be.mad.us>
Organization: Commercial Dynamics Pty Ltd, N.S.W., Australia
Reply-To: mgjv@comdyn.com.au
Mail-Copies-To: nobody
Message-ID: <slrn8bm9r6.nb.mgjv@verbruggen.comdyn.com.au>
X-Newsreader: slrn (0.9.6.2 Linux)
Date: Tue, 29 Feb 2000 01:56:58 GMT
X-Complaints-To: abuse@telstra.net
X-Trace: nsw.nnrp.telstra.net 951789418 203.30.80.34 (Tue, 29 Feb 2000 12:56:58 EST)
NNTP-Posting-Date: Tue, 29 Feb 2000 12:56:58 EST
X-Original-NNTP-Posting-Host: 203.30.80.34
Sender: clpm-owner@lists.eyrie.org
Precedence: bulk

On Mon, 28 Feb 2000 14:35:39 -0800,
	Chris Hostetter (The Hoss Man) <nospam@dont.spam.me.or.ill.be.mad.us> wrote:
> 
> Acctually, this behaviour is well documented in the man pages...
> 
> legoland:~> perl -v
> 
> This is perl, version 5.004_04 built for sun4-solaris
> 
> Copyright 1987-1997, Larry Wall
> 
> Perl may be copied only under the terms of either the Artistic License
> or the
> GNU General Public License, which may be found in the Perl 5.0 source
> kit.
> 
> legoland:~> perldoc perlsyn | grep -3 "innermost enclosing loop"
> 
>      the loop for the loop control statements next, last, and
>      redo.  If the LABEL is omitted, the loop control statement
>      refers to the innermost enclosing loop.  This may include
>      dynamically looking back your call-stack at run time to find
>      the LABEL.  Such desperate behavior triggers a warning if
>      you use the -w flag.

That just documents it for use in loop control statements. It does not
document it for use in a sub block. It may very well be, and probably
is, what is happening, but you can't say it is documented to work that
way. the C<next> entry in the perlfunc man page explicitly states that
you cannot use it in a block that returns a value.

Martien
- -- 
Martien Verbruggen              | 
Interactive Media Division      | Make it idiot proof and someone will
Commercial Dynamics Pty. Ltd.   | make a better idiot.
NSW, Australia                  | 

------- Message 7

Forwarded: Thu, 02 Mar 2000 15:34:44 -0500
Replied: Wed, 01 Mar 2000 02:20:48 -0500
Delivered-To: clpm@lists.eyrie.org
To: clpm@lists.eyrie.org
From: tgy@chocobo.org (Neko)
Newsgroups: comp.lang.perl.moderated
Subject: Re: Why can a next within subroutine influence code outside the  subroutine?
Date: Tue, 29 Feb 2000 12:36:11 -0800
Organization: Moogle Stuffy Studios
Message-ID: <gRu8OLJwtA109C7NhM2lYOxpKkAB@4ax.com>
References: <89e6s0$s60$1@nntp.Stanford.EDU> <38BAF83B.60647F4C@dont.spam.me.or.ill.be.mad.us> <slrn8bm9r6.nb.mgjv@verbruggen.comdyn.com.au>
Reply-To: tgy@chocobo.org
X-Complaints-To: newsabuse@supernews.com
X-Newsreader: Forte Agent 1.6/32.525
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: clpm-owner@lists.eyrie.org
Precedence: bulk

On Tue, 29 Feb 2000 01:56:58 GMT, mgjv@verbruggen.comdyn.com.au (Martien
Verbruggen) wrote:

>On Mon, 28 Feb 2000 14:35:39 -0800,
>	Chris Hostetter (The Hoss Man) <nospam@dont.spam.me.or.ill.be.mad.us> wrote:
>> 
>> Acctually, this behaviour is well documented in the man pages...
>> 
>> legoland:~> perldoc perlsyn | grep -3 "innermost enclosing loop"
>> 
>>      the loop for the loop control statements next, last, and
>>      redo.  If the LABEL is omitted, the loop control statement
>>      refers to the innermost enclosing loop.  This may include
>>      dynamically looking back your call-stack at run time to find
>>      the LABEL.  Such desperate behavior triggers a warning if
>>      you use the -w flag.
>
>That just documents it for use in loop control statements. It does not
>document it for use in a sub block.

That *does* document the behavior for sub blocks.  You get no warnings from -w
regardless of how many inner/outer loops there are.

>It may very well be, and probably
>is, what is happening, but you can't say it is documented to work that
>way. the C<next> entry in the perlfunc man page explicitly states that
>you cannot use it in a block that returns a value.

That paragraph (and similar ones for 'last' and 'redo') was added sometime after
Perl 5.005_01.  From 5.005_3:

    next cannot be used to exit a block which returns a value such as
    eval {}, sub {} or do {}, and should not be used to exit a grep()
    or map() operation. 

It looks like the perlsyn documentation about loop control statements needs to
be amended.  And the warnings in perldiag should be changed as well, from:

    Exiting subroutine via %s
    
        (W) You are exiting a subroutine by unconventional means, such as
        a goto, or a loop control statement.
    
To something like:

        (F) You cannot exit a subroutine through a loop control statement.

I omitted 'goto' in that hypothetical fatal warning because perlfunc does not
document exiting a subroutine throught 'goto' as a "cannot":

    It may not be used to go into any construct that requires initialization,
    such as a subroutine or a foreach loop. It also can't be used to go into a
    construct that is optimized away, or to get out of a block or subroutine
    given to sort().  It can be used to go almost anywhere else within the
    dynamic scope, including out of subroutines, but it's usually better to use
    some other construct such as last or die().

Hm... looks like the documentation for 'goto' need to be fixed as well.  It's
actually recommending that you use 'last' instead of 'goto' to get out of a
subroutine.

- -- 
Neko

------- Message 8

Forwarded: Thu, 02 Mar 2000 15:34:44 -0500
Delivered-To: clpm@lists.eyrie.org
Message-ID: <20000301072047.8953.qmail@plover.com>
To: clpm@lists.eyrie.org
Subject: Re: Why can a next within subroutine influence code outside the subroutine? 
In-Reply-To: Your message of "Tue, 29 Feb 2000 12:36:11 PST."
             <gRu8OLJwtA109C7NhM2lYOxpKkAB@4ax.com> 
Date: Wed, 01 Mar 2000 02:20:47 -0500
From: Mark-Jason Dominus <mjd@plover.com>
Newsgroups: comp.lang.perl.moderated
References: <gRu8OLJwtA109C7NhM2lYOxpKkAB@4ax.com>
Sender: clpm-owner@lists.eyrie.org
Precedence: bulk

On Tue, 29 Feb 2000 01:56:58 GMT, mgjv@verbruggen.comdyn.com.au (Martien
Verbruggen) wrote:
> >>      the loop for the loop control statements next, last, and
> >>      redo.  If the LABEL is omitted, the loop control statement
> >>      refers to the innermost enclosing loop.  This may include
> >>      dynamically looking back your call-stack at run time to find
> >>      the LABEL.  Such desperate behavior triggers a warning if
> >>      you use the -w flag.
> >
> >That just documents it for use in loop control statements. It does not
> >document it for use in a sub block.

No,  `loop control statement' here refers to `next', `last', and
`redo', not to `for' or `while'.   So the meaning of this:

        If the LABEL is omitted, the loop control statement refers to
        the innermost enclosing loop. ...

is actually:

        If the LABEL is omitted, the `next', `last', and `redo'
        operators refer to the innermost enclosing loop.  This may
        include dynamically looking back your call-stack at run time
        to find [one].

tgy@chocobo.org (Neko) said:
> That *does* document the behavior for sub blocks.  You get no
> warnings from -w regardless of how many inner/outer loops there are.

Sure you do.  Try this:

        sub fred { last }
        for (1 .. 20) { $n = $_; fred() if $_ == 11 }
        print "$n\n";

You get this warning:
        Exiting subroutine via last at /tmp/lb.pl line 1.

And the value of $n that is printed is:
        11

Which shows that the `next' in the subroutine *does* look back up the
call stack and exit the outer `for' loop, and you *do* get a warning
from it.  And also, fred() never gets the opportunity to return a
value, because you jumped out of it and clear out of the context in
which it was called; if you replace fred() above with $g = fred(),
$g remains undefined after fred() `returns'.

> It looks like the perlsyn documentation about loop control
> statements needs to be amended.

They seem accurate to me.

> And the warnings in perldiag should be changed as well, from:
> 
>     Exiting subroutine via %s
>     
>         (W) You are exiting a subroutine by unconventional means, such as
>         a goto, or a loop control statement.
>     
> To something like:
> 
>         (F) You cannot exit a subroutine through a loop control statement.

No, certainly not, because you can exit a subroutine through a loop
control statement, and it's not a fatal error.  Please remember that
the phrase `loop control statement' in the existing error message
refers to `next', `last', or `redo', so what it really means is:

     Exiting subroutine via %s
     
         (W) You are exiting a subroutine by unconventional means, such as
         a goto, or a a next, last, or redo statement.

> I omitted 'goto' in that hypothetical fatal warning because perlfunc does not
> document exiting a subroutine throught 'goto' as a "cannot":

The `cannot' in the description ihas misled you.  What that is
addressing is a common question involving grep and map.  here is an
example of the question:

A:        ``I have some arrays of numbers and I want to see which ones
        contain ant numbers that are bigger than 100.  I am going to
        use this code:'' 

                for $a (@arrays) {
                  if (grep {$_ > 100} @$a) { ... }
                }

B:        ``That is a bad thing to do, because the `grep' will search
        all the way to the end, even if there is a large number at the
        beginning of the array, and that is a waste of time.''

A:         ``In that case I will tell `grep' to stop as
         soon as it sees a large number:''

                for $a (@arrays) {
                  if (grep {$_ > 100 and last} @$a) { ... }
                }

But `last' doesn't escape from `grep'.  Or rather, it *does*, but it
also escapes the enclosing `for'.  The `cannot' in the manual means
`it does not do what you want', rather than `it is forbidden'.   If
what you you really want to jump clear out of the smallest loop that
*encloses* the grep, it works just fine.

> It's actually recommending that you use 'last' instead of 'goto' to
> get out of a subroutine.

No, it's recommending that you avoid non-local transfer of control
entirely, and stick to the more structured and constrained forms like
`last' where possible.

------- Message 9

Forwarded: Thu, 02 Mar 2000 15:34:44 -0500
Replied: Thu, 02 Mar 2000 08:45:21 -0500
Delivered-To: clpm@lists.eyrie.org
To: clpm@lists.eyrie.org
From: buhr@stat.wisc.edu (Kevin Buhr)
Newsgroups: comp.lang.perl.moderated
Subject: Re: Why can a next within subroutine influence code outside the subroutine?
Date: 01 Mar 2000 16:21:59 -0600
Organization: University of Wisconsin, Madison
Message-ID: <vbaog8ynxfc.fsf@mozart.stat.wisc.edu>
References: <sbjgsqbojp150@corp.supernews.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
X-Trace: news.doit.wisc.edu 951949319 640792 128.105.5.24 (1 Mar 2000 22:21:59 GMT)
X-Complaints-To: abuse@doit.wisc.edu
NNTP-Posting-Date: 1 Mar 2000 22:21:59 GMT
User-Agent: Gnus/5.070097 (Pterodactyl Gnus v0.97) Emacs/20.5
X-Original-NNTP-Posting-Host: mozart.stat.wisc.edu
Sender: clpm-owner@lists.eyrie.org
Precedence: bulk

"Stephen Gertsch" <sgertsch@slip.net> writes:
> 
> I do not understand why perl allows the use of 'next' outside the context
> block to which it pertains.

Surprisingly, this appears to work with named blocks, too.  That is, a
subroutine like:

        sub poof {
                next outer;
        }

appears to, at the point of invocation, dynamically search outward for
the innermost block with a matching name "outer".

Believe it or not, this behavior *is* acknowledged in the
documentation.  From perlsyn(1), we see:

        The LABEL identifies the loop for the loop control statements
        next, last, and redo.  If the LABEL is omitted, the loop
        control statement refers to the innermost enclosing loop.  This
        may include dynamically looking back your call-stack at run
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^      
        time to find the LABEL.  Such desperate behavior triggers a
        ^^^^
        warning if you use the -w flag.

IMHO, it's too bad this triggers a warning at all.  It seems like it
would allow for some rather clever ways to write user-defined control
structures.  Consider the infamous "missing switch statement" problem.
With syntactic glue like:

        sub switch ($&) { for ($_[0]) { &{$_[1]} } }
        sub default (&) { &{$_[0]}; next }
        sub case ($$) { if ($_ =~ /^$_[0]$/) { &{$_[1]}; next } }

you can actually write:

        for my $x (qw(3 2 3 1 junk 2 1)) {
            switch $x, sub {
                case 1, sub { print "1\n" };
                case 2, sub { print "2\n" };
                case 3, sub { print "3\n" };
                default { print "default: $_\n"; };
            };
        };

and have it work, at least under my 5.005_03.  No more forgotting
those pesky "last"s!  (Intentional "falls through" can be handled by
simply defining a "case_ft" variant of the "case" subroutine.)

Maybe others can come up with some cleverer examples.

All the follow-ups seemed to conclude that the documentation must
immediately be fixed and Perl patched to "fix" this behavior?

Why?  Is there some potential downside or danger I've missed?

Kevin <buhr@stat.wisc.edu>

------- Message 10

Forwarded: Thu, 02 Mar 2000 15:34:44 -0500
Delivered-To: clpm@lists.eyrie.org
To: clpm@lists.eyrie.org
From: dformosa@zeta.org.au (David Formosa aka ? the Platypus)
Newsgroups: comp.lang.perl.moderated
Subject: Re: Why can a next within subroutine influence code outside the subroutine?
Date: 2 Mar 2000 02:05:10 GMT
Organization: Zeta Internet, http://www.zeta.org.au/
Message-ID: <slrn8brj2v.3l8.dformosa@dformosa.zeta.org.au>
References: <sbjgsqbojp150@corp.supernews.com> <vbaog8ynxfc.fsf@mozart.stat.wisc.edu>
X-Trace: phaedrus.zeta.org.au 951962710 14579 202.7.69.25 (2 Mar 2000 02:05:10 GMT)
X-Complaints-To: abuse@zeta.org.au
NNTP-Posting-Date: 2 Mar 2000 02:05:10 GMT
X-Newsreader: slrn (0.9.4.3 UNIX)
X-Original-NNTP-Posting-Host: 202.7.69.25
Sender: clpm-owner@lists.eyrie.org
Precedence: bulk

On 01 Mar 2000 16:21:59 -0600, Kevin Buhr <buhr@stat.wisc.edu> wrote:

[...]

>IMHO, it's too bad this triggers a warning at all.  It seems like it
>would allow for some rather clever ways to write user-defined control
>structures.  Consider the infamous "missing switch statement" problem.
>With syntactic glue like:

You can localy disable the warnings.


- -- 
Please excuse my spelling as I suffer from agraphia. See
http://www.zeta.org.au/~dformosa/Spelling.html to find out more.

------- Message 11

Forwarded: Thu, 02 Mar 2000 15:34:44 -0500
Delivered-To: clpm@lists.eyrie.org
To: clpm@lists.eyrie.org
From: yf110@victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Why can a next within subroutine influence code outside the subroutine?
Newsgroups: comp.lang.perl.moderated
References: <sbjgsqbojp150@corp.supernews.com>
Organization: Victoria Telecommunity Network
Distribution: 
X-Newsreader: TIN [version 1.2 PL2]
X-Original-NNTP-Posting-Host: 199.60.222.3
Message-ID: <38bdd448@news.victoria.tc.ca>
Date: 1 Mar 2000 18:39:04 -0800
X-Trace: 1 Mar 2000 18:39:04 -0800, 199.60.222.3
Xpident: yf110
X-Original-NNTP-Posting-Host: 199.60.222.3
Sender: clpm-owner@lists.eyrie.org
Precedence: bulk

Stephen Gertsch (sgertsch@slip.net) wrote:
: I do not understand why perl allows the use of 'next' outside the context
: block to which it pertains.

The 'next' is not outside the "runtime" context of the block.  At
runtime the code is running within a loop - that's its context.

This context is very similar to the context of exception handlers.  The
handler invoked when an exception is raised basically depends on the call
stack.  i.e. in a typical language with exception handling, raising an
exception is similar to doing a long jump to one of the functions higher
up the call stack.  (Yes, I know this isn't always or exactly correct.)
The code that handles the error is often not known to the code that raised
the exception.

You will notice that this is also very similar to the context used by
'local'. When a variable is 'local'ized then this effects all code which
uses this variable until the code which 'local'ized the variable reaches
the end of it's block.  In other words local has a "runtime" scope (as
opposed to 'my' which effects just the code within the lexical, i.e.
"compile time", scope of a program). 


: It appears to me that perl subroutines behave more like macros than
: subroutines.


A subroutine with no parameters is a little bit like a macro.  You will
notice that such a subroutine has access to its caller's parameters (in
@_), just as if they were its own.

------- Message 12

Forwarded: Thu, 02 Mar 2000 15:34:44 -0500
Delivered-To: clpm@lists.eyrie.org
To: clpm@lists.eyrie.org
From: tgy@chocobo.org (Neko)
Newsgroups: comp.lang.perl.moderated
Subject: Re: Why can a next within subroutine influence code outside the subroutine?
Date: Wed, 01 Mar 2000 20:56:26 -0800
Organization: Moogle Stuffy Studios
Message-ID: <WOa9OEO34SkcqBGgGZ7QInSS56hm@4ax.com>
References: <gRu8OLJwtA109C7NhM2lYOxpKkAB@4ax.com> <20000301072047.8953.qmail@plover.com>
Reply-To: tgy@chocobo.org
X-Complaints-To: newsabuse@supernews.com
X-Newsreader: Forte Agent 1.6/32.525
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: clpm-owner@lists.eyrie.org
Precedence: bulk

On Wed, 01 Mar 2000 02:20:47 -0500, Mark-Jason Dominus <mjd@plover.com> wrote:

>
>On Tue, 29 Feb 2000 01:56:58 GMT, mgjv@verbruggen.comdyn.com.au (Martien
>Verbruggen) wrote:
>> >>      the loop for the loop control statements next, last, and
>> >>      redo.  If the LABEL is omitted, the loop control statement
>> >>      refers to the innermost enclosing loop.  This may include
>> >>      dynamically looking back your call-stack at run time to find
>> >>      the LABEL.  Such desperate behavior triggers a warning if
>> >>      you use the -w flag.
>> >
>> >That just documents it for use in loop control statements. It does not
>> >document it for use in a sub block.
>
>tgy@chocobo.org (Neko) said:
>> That *does* document the behavior for sub blocks.  You get no
>> warnings from -w regardless of how many inner/outer loops there are.
>
>Sure you do.  Try this:
>
>        sub fred { last }
>        for (1 .. 20) { $n = $_; fred() if $_ == 11 }
>        print "$n\n";
>
>You get this warning:
>        Exiting subroutine via last at /tmp/lb.pl line 1.

Let me rephrase that:  You get no warnings from -w *because* of how many
inner/outer loops there are.  The warnings are generated from exiting the
subroutine.  Hence, the documentation *does* document the behavior for sub
blocks.

>> It looks like the perlsyn documentation about loop control
>> statements needs to be amended.
>
>They seem accurate to me.

They seemed accurate to me also.  But then the documentation for 'next', 'last',
and 'redo' rather unambiguously state that they cannot be used to exit a
subroutine.  From perlfunc:

    next cannot be used to exit a block which returns a value such
    as eval {}, sub {} or do {}, and should not be used to exit a
    grep() or map() operation. 

>> I omitted 'goto' in that hypothetical fatal warning because perlfunc does not
>> document exiting a subroutine throught 'goto' as a "cannot":
>
>The `cannot' in the description ihas misled you.  What that is
>addressing is a common question involving grep and map.  here is an
>example of the question:

The "cannot" in the description clearly refers to eval/sub/do whereas the
"should not" applies to grep/map.  Thank you for explaining why next/last/redo
should not be used to exit the latter two constructs.

Perhaps I am reading the documentation too literally.  Perhaps it meant to say
this instead:

    next cannot be *usefully* used to exit a block which returns a value such
    as eval {}, sub {} or do {}, and should not be used to exit a
    grep() or map() operation. 

>> It's actually recommending that you use 'last' instead of 'goto' to
>> get out of a subroutine.
>
>No, it's recommending that you avoid non-local transfer of control
>entirely, and stick to the more structured and constrained forms like
>`last' where possible.

That's what I said. :)

- -- 
Neko

------- Message 13

Forwarded: Thu, 02 Mar 2000 15:34:44 -0500
Delivered-To: clpm@lists.eyrie.org
To: clpm@lists.eyrie.org
From: Bernie Cosell <bernie@fantasyfarm.com>
Newsgroups: comp.lang.perl.moderated
Subject: Re: Why can a next within subroutine influence code outside the subroutine?
Date: Thu, 02 Mar 2000 08:39:40 -0500
Organization: Fantasy Farm Fibers
Message-ID: <a7rsbscc96s4s2la3mpau9f79m1ue0ikla@4ax.com>
References: <sbjgsqbojp150@corp.supernews.com> <38bdd448@news.victoria.tc.ca>
X-Complaints-To: newsabuse@supernews.com
X-Newsreader: Forte Agent 1.7/32.534
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: clpm-owner@lists.eyrie.org
Precedence: bulk

yf110@victoria.tc.ca (Malcolm Dew-Jones) wrote:

} Stephen Gertsch (sgertsch@slip.net) wrote:
} : I do not understand why perl allows the use of 'next' outside the context
} : block to which it pertains.
} 
} The 'next' is not outside the "runtime" context of the block.  At
} runtime the code is running within a loop - that's its context.
} 
} This context is very similar to the context of exception handlers.

In fact, that's kind of neat, I guess: you could use a non-local 'last'
and/or 'next' as a kind of "raise exception".

} You will notice that this is also very similar to the context used by
} 'local'. When a variable is 'local'ized then this effects all code which
} uses this variable until the code which 'local'ized the variable reaches
} the end of it's block.  In other words local has a "runtime" scope (as
} opposed to 'my' which effects just the code within the lexical, i.e.
} "compile time", scope of a program). 

All true only it is *usually* the case that program constructs deal with
lexical scope, and so it is a bit surprising when it doesn't  Is there
another language that handles control-structures with dynamic scope? [I'm
pretty sure C doesn't, although I haven't done much C programming in recent
years and then again, I'd have guessed that 'Duff's device' wouldn't have
worked, either so what do I know..:o)]

  /Bernie\
- -- 
Bernie Cosell                     Fantasy Farm Fibers
bernie@fantasyfarm.com            Pearisburg, VA
    -->  Too many people, too few sheep  <--          

------- Message 14

Forwarded: Thu, 02 Mar 2000 15:34:44 -0500
Delivered-To: clpm@lists.eyrie.org
Message-ID: <20000302134718.15164.qmail@plover.com>
To: clpm@lists.eyrie.org
Subject: Re: Why can a next within subroutine influence code outside the subroutine? 
Organization: Plover Systems
In-Reply-To: buhr@stat.wisc.edu (Kevin Buhr's) message of "01 Mar 2000 16:21:59 CST."
             <vbaog8ynxfc.fsf@mozart.stat.wisc.edu> 
Date: Thu, 02 Mar 2000 08:47:18 -0500
From: Mark-Jason Dominus <mjd@plover.com>
Newsgroups: comp.lang.perl.moderated
References: <vbaog8ynxfc.fsf@mozart.stat.wisc.edu>
Sender: clpm-owner@lists.eyrie.org
Precedence: bulk

buhr@stat.wisc.edu (Kevin Buhr):
>         sub switch ($&) { for ($_[0]) { &{$_[1]} } }
>         sub default (&) { &{$_[0]}; next }
>         sub case ($$) { if ($_ =~ /^$_[0]$/) { &{$_[1]}; next } }

That's really cool!

> Maybe others can come up with some cleverer examples.

I don't think this is cleverer, but here's a trick from my `Tricks of
the Wizards' talk that uses it:

- ----------------------------------------------------------------

Build Your Own [[map]]
**********************

o [[map]] and [[grep]] are great.

o Wouldn't it be nice to make some new, similar operators?

o Example:

	$n = reduce { $a + $b } 1, 4, 2, 8, 5, 7

(Yields the sum, 27)

	$n = reduce { $a * $b } 1, 4, 2, 8, 5, 7

(Yields the product, 2240)

	$n = reduce { $a > $b ? $a : $b } 1, 4, 2, 8, 5, 7

(Yields the max, 8)

	$n = reduce { [@$a, $b] } 1, 4, 2, 8, 5, 7

(Yields a list, [1,4,2,8,5,7])

- ----------------------------------------------------------------

[[reduce]]
**********

	sub reduce (&$@) {
	  my $code = shift;
	  local $a = shift;

	  for (@_) {
	    local $b = $_;
	    $a = &$code;
	  }

	  $a;
	}

o [[(&$@)]]?!

o [[local]]?!

o Why [[$a]] and [[$b]]?

- ----------------------------------------------------------------

[[reduce]]
**********

o Here's a fine, fine trick.

o Let's write a [[reduce]] call to ask if a list contains all positive numbers.

	reduce { $a && $b > 0 } "yes", @list;

o If you apply this to the list [[(0 .. 1000000)]], it goes all way to the end

o Solution:

	reduce { $a && $b > 0 || ($a=undef, last) } "yes", @list;

o [[last]]?!

o Yes!  [[last]] is dynamically scoped!

- ----------------------------------------------------------------

> All the follow-ups seemed to conclude that the documentation must
> immediately be fixed and Perl patched to "fix" this behavior?

Not mine!


Mark-Jason Dominus 	  			                 mjd@plover.com
I am boycotting Amazon. See http://www.plover.com/~mjd/amazon.html for details.

------- Message 15

Forwarded: Thu, 02 Mar 2000 15:34:44 -0500
Replied: Thu, 02 Mar 2000 14:23:03 -0500
Replied: Thu, 02 Mar 2000 12:44:26 -0500
Delivered-To: clpm@lists.eyrie.org
To: clpm@lists.eyrie.org
From: Mark Thomas <mthomas+posting@edrc.cmu.edu>
Newsgroups: comp.lang.perl.moderated
Subject: Re: Why can a next within subroutine influence code outside the subroutine?
Date: Thu, 2 Mar 2000 12:20:58 -0500 (EST)
Organization: Carnegie Mellon Univ. -- Computer Science Dept.
Message-ID: <14526.41722.888079.981532@ulysses.jprc.com>
References: <vbaog8ynxfc.fsf@mozart.stat.wisc.edu>
	<20000302134718.15164.qmail@plover.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: cantaloupe.srv.cs.cmu.edu 952017697 24000 128.2.198.221 (2 Mar 2000 17:21:37 GMT)
X-Complaints-To: postmaster@cs.cmu.edu
NNTP-Posting-Date: 2 Mar 2000 17:21:37 GMT
In-Reply-To: Mark-Jason Dominus's message of Thursday,  2 Mar 2000 08:47:18 -0500
X-Mailer: VM 6.75 under 21.2  (beta31) "Iris" XEmacs Lucid
Originator: mthomas@ux5.sp.cs.cmu.edu
X-Original-NNTP-Posting-Host: ux5.sp.cs.cmu.edu
X-Original-Sender: netnews+@cantaloupe.srv.cs.cmu.edu
Sender: clpm-owner@lists.eyrie.org
Precedence: bulk

Mark-Jason Dominus <mjd@plover.com> writes:
  > 	$n = reduce { [@$a, $b] } 1, 4, 2, 8, 5, 7

  > (Yields a list, [1,4,2,8,5,7])

I get [4,2,8,5,7].  If I run under strict, I get the error 
  Can't use string ("1") as an ARRAY ref while "strict refs" in use

This should probably be
  $n = reduce { [@$a, $b] } [1], 4, 2, 8, 5, 7


  > o [[(&$@)]]?!

I assume you use this prototype so that the following produce
compile-time errors
  reduce {$a + $b};
  reduce {$a + $b}, 1, 2;

One problem with the prototype is that I might initially assume
  @n = 0..4;
  $n = reduce {$a + $b} @n;
to yield the sum of the elements of @n and return 10, but it returns 5
(scalar @n).  I have to either list the arguments explicitly like you
do in the examples, or resort to "trickery" such as
  $n = reduce {$a + $b} $n[0], $n[1..$#n];

Personally, I think I would change the prototype to &@.  I can do
without the compile time error if it means that 
  reduce {$a + $b} @n;
works more like I expect it to.

- -Mark

------- Message 16

Forwarded: Thu, 02 Mar 2000 15:34:44 -0500
Delivered-To: clpm@lists.eyrie.org
Message-ID: <20000302174426.17421.qmail@plover.com>
To: clpm@lists.eyrie.org
Subject: Re: Why can a next within subroutine influence code outside the subroutine? 
In-Reply-To: Your message of "Thu, 02 Mar 2000 12:20:58 EST."
             <14526.41722.888079.981532@ulysses.jprc.com> 
Date: Thu, 02 Mar 2000 12:44:26 -0500
From: Mark-Jason Dominus <mjd@plover.com>
Newsgroups: comp.lang.perl.moderated
References: <14526.41722.888079.981532@ulysses.jprc.com>
Sender: clpm-owner@lists.eyrie.org
Precedence: bulk

Mark Thomas <mthomas+posting@edrc.cmu.edu> writes:
> Mark-Jason Dominus <mjd@plover.com> writes:
>   > o [[(&$@)]]?!
> 
> I assume you use this prototype so that the following produce
> compile-time errors

No, I think it was something more subtle (and important) than that,
but I can't remember now why I chose to do it that way rather than to
use (&@).  I remember thinking about bother o them, and consciously
choosing the one I did, but I don't remember why.

I also remember that someone (maybe Greg Bacon?) sent me email a few
months ago saying pretty much the same thing, and that I thought `gee,
that's true, I wonder why I did it that way?' and then I did remember
why I did use (&$@) and decided it was better than the other way,
which is why I didn't change the slides.  But I can't find the mail
and I can't remember what the reason was.

> Personally, I think I would change the prototype to &@.  

Well, the nice thing about having free will is that you don't have to
do everything exactly the way other people tell you to.

]:)

------- Message 17

Forwarded: Thu, 02 Mar 2000 15:34:44 -0500
Delivered-To: clpm@lists.eyrie.org
Message-ID: <20000302192302.17967.qmail@plover.com>
To: clpm@lists.eyrie.org
Subject: Re: Why can a next within subroutine influence code outside the subroutine? 
In-Reply-To: Your message of "Thu, 02 Mar 2000 12:20:58 EST."
             <14526.41722.888079.981532@ulysses.jprc.com> 
Date: Thu, 02 Mar 2000 14:23:02 -0500
From: Mark-Jason Dominus <mjd@plover.com>
Newsgroups: comp.lang.perl.moderated
References: <14526.41722.888079.981532@ulysses.jprc.com>
Sender: clpm-owner@lists.eyrie.org
Precedence: bulk

>   > o [[(&$@)]]?!
> 
> I assume you use this prototype so that the following produce
> compile-time errors
>   reduce {$a + $b};
>   reduce {$a + $b}, 1, 2;

No, actually, that's not it.  (During lunch I pondered it and
remembered why.)  It's because the first argument is special---it's
the identity element for the operation.  So the examples are not
exactly true.  The real examples would be:

        $n = reduce { $a + $b } 0, (1, 4, 2, 8, 5, 7)

(Yields the sum, 27)

        $n = reduce { $a * $b } 1, (1, 4, 2, 8, 5, 7)

(Yields the product, 2240)

        $n = reduce { $a > $b ? $a : $b } MINUS_INFINITY, (1, 4, 2, 8, 5, 7)

(Yields the max, 8)

        $n = reduce { [@$a, $b] } [], (1, 4, 2, 8, 5, 7)

(Yields a list, [1,4,2,8,5,7])


Now, in the first three cases, you can get away with omitting the
special $ argument, and it's even more convenient to do so.  (In the
`max' example, it's *much* more convenient to do so.)  But (as you
pointed out) in the last example, you can't, and I suspect that the
reson that last example didn't work as I posted it was because I
incorrectly reduced it to the `simpler' case along with the others,
without checking it carefully.

But as that last example shows, there really is a special,
distinguished first argument, and although sometime you can omit it,
in general it is required.

> Personally, I think I would change the prototype to &@.  I can do
> without the compile time error if it means that 
>   reduce {$a + $b} @n;
> works more like I expect it to.

Unless @n turns out to be empty, in which case you get smoething rather
bizarre.  But if you do it my way, and stick with

        reduce {$a + $b} 0, @n;

you get the correct answer whether or not @n is empty.

What I posted was three slides from a tutorial that I gave at the
O'Reilly Perl conference last year.  In the tutorial, I will get about
279 seconds to show and explain those three slides, and that means
that the examples have to be absolutely as simple as possible, and so
sometimes I have to cut corners.  (For example, the `reduce' function
itself uses $_ without localizing it, potentially sabotaging the value
of $_ in the function that calls `reduce'.)  What you see is the
result of corner-cutting.  Magazine articles, where you can actually
take time to explain things in detail, are a much more forgiving
medium in many ways.  For example, I don't have time in the talk to
discuss the following delightful variation:

  sub reduce (&$) {
      my $code = shift;
      my $id = shift;

      sub { 
        local $_;
        local $a = $id;
        for (@_) {
          local $b = $_;
          $a = &$code;
        }

        $a;
      };
  }

This is now a function for manufactoring accumulation functions.
For example

        (reduce { $a + $b } 0)->(1..10);

returns 55, and 

        (reduce { $a + $b } 0)->();

returns 0 (as it should), and

        (reduce { $a + $b } 0)->(@array);
        
sums up the numbers in @array.  And if you're going to be summing a
lot of lists, you can write

my $sum = reduce { $a + $b } 0;

and then 

        &$sum(1..10);
        &$sum() ;
        &$sum(@array) ;

work as above; similarly

my $prod = reduce { $a + $b } 1;
my $make_list = reduce { [@$a, $b] } [];  # This one is hokey

------- Message 18

Delivered-To: clpm@lists.eyrie.org
To: clpm@lists.eyrie.org
From: gbacon@ruby.itsc.uah.edu (Greg Bacon)
Newsgroups: comp.lang.perl.moderated
Subject: Re: Why can a next within subroutine influence code outside the subroutine?
Date: 2 Mar 2000 20:51:41 GMT
Organization: The University of Alabama in Huntsville
Message-ID: <89mk8t$nf9$1@info2.uah.edu>
References: <14526.41722.888079.981532@ulysses.jprc.com>
    <20000302192302.17967.qmail@plover.com>
Reply-To: Greg Bacon <gbacon@cs.uah.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: info2.uah.edu 952030301 24041 146.229.2.53 (2 Mar 2000 20:51:41 GMT)
X-Complaints-To: news@news.uah.edu
NNTP-Posting-Date: 2 Mar 2000 20:51:41 GMT
X-Newsreader: knews 1.0b.1
X-Original-NNTP-Posting-Host: 146.229.2.53
Sender: clpm-owner@lists.eyrie.org
Precedence: bulk

In article <20000302192302.17967.qmail@plover.com>,
	Mark-Jason Dominus <mjd@plover.com> writes:

: (For example, the `reduce' function itself uses $_ without localizing
: it, potentially sabotaging the value of $_ in the function that calls
: `reduce'.)

Sorry to be pedantic, but the for loop localizes $_ for you.  Am I
missing something more subtle?

I like the pseudo-curried version:

    sub reduce (&$;@) {
        my $code = shift;
        my $id = shift;

        my $sub = sub {
            local $a = $id;
            for (@_) {
                local $b = $_;
                $a = &$code;
            }

            $a;
        };

        if (@_) {
            return $sub->(@_);
        }
        else {
            return $sub;
        }
    }

(is (programming functional) fun). :-)

Greg
- -- 
Beauty is in the eye of the beer holder...

------- End of Forwarded Messages


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