On Sun, Sep 09, 2001 at 04:36:00PM +0100, Dave Mitchell wrote:
> Rev Lebaredian <[EMAIL PROTECTED]> wrote:
>
> > >>> | > + my $large_string = eval ' "a" x 5_000_000 ';
> >
> > I'm not sure of this but it seems to me that the expression will work
> > without the eval. I'm guessing the eval is there as form of exception
> > handling in case the allocation fails. If this is the case then the
> > eval is being used for a well documented and recommended technique.
>
> No. In Perl, each operator, such as 'x', is (at compile time) allocated
> a private SV for storing its result. This SV is stored in the
> scratchpad of the sub the op is compiled into, and only gets deleted
> when the sub is deleted - this is usually at program exit, but happens
> earlier with an eval.
> Since in this context the eval is purely a way round a pecularity of the
> current implementation of perl, its use is probably not be be encouraged.
Yes. Otherwise we might as well document the proper use of black
candles and chicken blood.
>
> Dave M.
--
$jhi++; # http://www.iki.fi/jhi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen