On Sat, Mar 22, 2003 at 09:45:43PM +0200, arcadi shehter wrote:
in this example
sub a {
state $x ;
my $y ;
my sub b { ... } ;
...
}
how my sub b is different from state $x from the point of view of
scope ?
Actually, all three have the same scope, but they have different
Matthijs van Duin writes:
A nice example is:
sub a {
state $x;
my $y;
my sub b { return $x++ + $y++; }
return b; # is a \ before b needed?
}
Every call to sub a will return a different closure. The $x in
each closure all refer to the same variable.
On Sat, Mar 22, 2003 at 10:24:09PM +0200, arcadi shehter wrote:
sub a {
state $x;
my $y;
my sub b { state $z ; return $x++ + $y++ + $z++ ; }
return b; # is a \ before b needed?
}
will all b refer to the same $z ?
yes, they will
does it mean that this is legitimate
sub
Matthijs van Duin writes:
does it mean that this is legitimate
sub a {
state $x;
my $y;
state sub b { state $z ; return $x++ + $y++ + $z++ ; }
return b; # is a \ before b needed?
}
No, since you can't refer to $y in that sub (perl 5 actually
JüRgen BöMmels wrote:
[snip]
is(FILE, DATA, 'file content');
Shouldn't this be:
is(scalar FILE, DATA, 'file content');
(I don't recall whether is() provides scalar context to it's first
argument, but even if it does, it would be clearer to put the 'scalar'
in there anyway.)
[snip]
# New Ticket Created by Jürgen Bömmels
# Please include the string: [perl #21656]
# in the subject line of all future correspondence about this issue.
# URL: http://rt.perl.org/rt2/Ticket/Display.html?id=21656
Hello,
Yet another step in PIO:
Enabling read buffering.
The first read will