develooper Front page | perl.perl5.porters | Postings from September 2009

replacing $[

Thread Next
September 27, 2009 00:21
replacing $[
Message ID:
I've just uploaded to CPAN a module, Array::Base, which reimplements
$[ without any core support.  The impatient can find it at

As previously proposed, it operates by hooking the op checkers for
aelem, aslice, and av2arylen ops.  (aelemfast is generated by the
base checker for aelem, and so does not need to be hooked separately.)
It works on perl 5.8.1 and later (except for a problem with lexical $_
affecting slicing on 5.9.1, which I only tested on out of curiosity).
It can't work on any earlier perl version, because aslice ops don't go
through the check process prior to 5.8.1.

It doesn't affect index and substr, as $[ does.  If anyone wants the
offset for those ops, I think it should be implemented as another module,
separate from the array one.

Can we get rid of $[ now?


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About