bin@rhesus.primate.wisc.edu (Brain in Neutral) (06/30/88)
The perl 2.0 manual contains two examples that use {{ and }} instead of { and } to bracket subroutines. One of them says to note the double curly brackets. But what do they mean? The explanation is not in the manual, or at least I can't find it. Yours, Paul DuBois dubois@rhesus.primate.wisc.edu rhesus!dubois bin@rhesus.primate.wisc.edu rhesus!bin
markb@sdcrdcf.UUCP (07/01/88)
In article <335@rhesus.primate.wisc.edu> bin@rhesus.primate.wisc.edu (Brain in Neutral) writes: >The perl 2.0 manual contains two examples that use {{ and }} >instead of { and } to bracket subroutines. One of them says >to note the double curly brackets. But what do they mean? >The explanation is not in the manual, or at least I can't >find it. Those are realy 4 symbols not 2. The {} that delimit the body of a subroutine are not a BLOCK (see man page) so if you want to do things like use "last" as a pseudo-return statement you have to have an additional set of {} delimiting a real BLOCK. I have complained about this to Larry before (as well as I can see no reason why "last" can work right in a "do { ... }" expression too.) Mark Biggar {allegra,burdvax,cbosgd,hplabs,ihnp4,akgua,sdcsvax}!sdcrdcf!markb markb@rdcf.sm.unisys.com
lwall@devvax.JPL.NASA.GOV (Larry Wall) (07/01/88)
In article <335@rhesus.primate.wisc.edu> bin@rhesus.primate.wisc.edu (Brain in Neutral) writes:
: The perl 2.0 manual contains two examples that use {{ and }}
: instead of { and } to bracket subroutines. One of them says
: to note the double curly brackets. But what do they mean?
: The explanation is not in the manual, or at least I can't
: find it.
Would it help if I said that {{ and }} aren't composite tokens? The inner
brackets make a normal old block, which in perl is treated as a loop that's
executed once, meaning you can use the normal loop exit to exit the
subroutine. No magic here.
Larry Wall
lwall@jpl-devvax.jpl.nasa.gov