Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: POD for use feature 'declared_refs' wrong

by kcott (Archbishop)
on Oct 18, 2021 at 17:55 UTC ( [id://11137693]=note: print w/replies, xml ) Need Help??


in reply to Re^2: POD for use feature 'declared_refs' wrong
in thread POD for use feature 'declared_refs' wrong

"FWIW Perl4 had an aliasing feature ..."

Purely as an historical note, I do recall reading about that in the first Camel book. In perlhist:

Perl 4 introduced the first Camel book.  Really.  We mostly just
    switched version numbers so the book could refer to 4.000.

So that feature would have existed in Perl3. I don't have any information on which specific Perl version introduced it. I don't believe I used that feature in any version prior to Perl5.

— Ken

  • Comment on Re^3: POD for use feature 'declared_refs' wrong

Replies are listed 'Best First'.
Re^4: POD for use feature 'declared_refs' wrong
by LanX (Saint) on Oct 19, 2021 at 09:43 UTC
    I'm pretty sure one needed to pass a glob for multiple arrays, because references were missing

      foo(*arr1,*arr2)

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      A trip down memory lane ...

      I reached across my desk and grabbed my original (pink) version of the Camel book. After blowing off a decade or two's worth of dust, I had a look around.

      [Note: The printing history shows Jan. 1991 as "First Edition", then Aug. 1991 and Mar. 1992 as "Minor corrections". It would be a fair assumption that I have the more recent of those; page numbers below may be out by one or two for those with other versions.]

      In "Chapter 3 The Gory Details" (pp. 65-121); under the "Packages" section (pp.119-121); I found on page 120:

      local(*foo) = *bar; local($_main{'foo'}) = $_main{'bar'};

      ... the *foo is more efficient because it does the symbol table lookup once at compile time ...

      Also of nostalgic interest was the use of $main'var instead of $main::var. I haven't used the former version in over 20 years; however, it's still valid:

      $ cat pm_11137628_pkg_sep.pl use strict; use warnings; our $x = 42; print $], "\n"; print $main'x, "\n"; print $main::x, "\n";
      $ perl pm_11137628_pkg_sep.pl 5.034000 42 42
      "foo(*arr1,*arr2)"

      Under the "Subroutines" section (pp. 99-102); on page 99; I note a small syntax change is required:

      "A subroutine is called using the do operator or the & operator. The & operator is the preferred form."

      However, other than that small syntax change, the gist of what you wrote is correct. There's an example on page 102:

      sub arrayadd { local(*a, *b) = @_; ... } @foo = (1,2,3); @bar = (10,20,30); @totals = &arrayadd(*foo, *bar);

      [Disclaimer: Everything I've quoted from the book needed to be entered by hand. I believe it's all correct but apologise in advance for any typos that may have crept in.]

      The "trip down memory lane" concludes. I hope that was an interesting read. I do acknowledge that it was way off-topic with respect to the OP subject.

      — Ken

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11137693]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-19 17:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found