in reply to Closure Confusion
i tried another way and confused myself somehow ;)
my initial thought was that if you put the scalar value inside double quotes it immediately stringifies, thus evaluating to a string that is just printed out.
my initial thought was that if you put the scalar value inside double quotes it immediately stringifies, thus evaluating to a string that is just printed out.
this does not happen - it seems that the sub call takes the block as-is and returns a code reference. is there an explicit stringify operator for scalars? is this way feasible? my feeling says no, but i do not know it.push (@closures, sub {print "$j";});
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Closure Confusion
by Aristotle (Chancellor) on Oct 17, 2002 at 01:54 UTC | |
by kabel (Chaplain) on Oct 17, 2002 at 06:54 UTC | |
by Aristotle (Chancellor) on Oct 17, 2002 at 12:54 UTC | |
by kabel (Chaplain) on Oct 17, 2002 at 14:32 UTC | |
Re: Re: Closure Confusion
by chromatic (Archbishop) on Oct 16, 2002 at 23:28 UTC |
In Section
Seekers of Perl Wisdom