in reply to Anon. array of refs to a range generated list of scalars.

I do think it's strange that perl is genning up an array where you didn't ask for one. Maybe it's a bug.

But besides your map solution, this also works:
\( (sub{6..9})->() )
Note that using the ampersand form to call the sub doesn't work. I guess perl decides that you want a ref to the sub if you do that.
(Update; thanks Aristotle.) You could also write that as
\( &{sub{6..9}}() )

jdporter
The 6th Rule of Perl Club is -- There is no Rule #6.

Replies are listed 'Best First'.
Re: Re: Anon. array of refs to a range generated list of scalars.
by sauoq (Abbot) on Jan 18, 2003 at 20:36 UTC
    \do{6..9}
    -sauoq
    "My two cents aren't worth a dime.";
    

      Neat! From that I realised that you can also do

      [\map$_,1..9]
      But yours is much tidier.

      Examine what is said, not who speaks.

      The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.

Re^2: Anon. array of refs to a range generated list of scalars.
by Aristotle (Chancellor) on Jan 18, 2003 at 17:55 UTC
    Does too, you have to write \( &{sub{6..9}}() )

    Makeshifts last the longest.