Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8431315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:49:18+00:00 2026-06-10T05:49:18+00:00

Sorry for may be not clear question, but I’m asking it, because I don’t

  • 0

Sorry for may be not clear question, but I’m asking it, because I don’t like to read something without understanding what I’m reading about.

Here is the snippet from the "Programming Perl":

Since the way in which you dereference something always indicates what sort of
referent you’re looking for
, a typeglob can be used the same way a reference can,
despite the fact that a typeglob contains multiple referents of various types. So
${*main::foo} and ${\$main::foo} both access the same scalar variable, although
the latter is more efficient.

For me this seems wrong, and that it would be right if it were this way:

you can use a typeglob instead of the scalar variable because reference is always a scalar and compiler knows what you need.

From the book’s text, the reader can assume that a reference can be something other than a scalar variable (i.e. a scalar entry in the symbol table).
Once I saw a warning: use of array as a reference is deprecated, so it appears to me that long ago this paragraph in the "Programming Perl" was meaningful, because references could be not just scalars, but in the new 4th edition it simply was not changed to comply with modern Perl.

I checked the errata page for this book but found nothing.

Is my assumption correct? If not, would be somebody so pleasant to explain, where I’m wrong.

Thank you in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T05:49:20+00:00Added an answer on June 10, 2026 at 5:49 am

    No. What it’s saying is that unlike a normal reference, a typeglob contains multiple types of things at the same time. But the way in which you dereference it indicates which type of thing you want:

    use strict;
    use warnings;
    use 5.010;
    
    our $foo = 'scalar';
    our @foo = qw(array of strings);
    our %foo = (key => 'value');
    
    say ${ *foo };                  # prints "scalar"
    say ${ *foo }[0];               # prints "array"
    say ${ *foo }{key};             # prints "value"
    

    You don’t need a special “typeglob dereferencing syntax” because the normal
    dereferencing syntax already indicates which slot of the typeglob you want to dereference.

    Note that this doesn’t work with my variables, because lexical variables aren’t associated with typeglobs.

    Sidenote: The “array as a reference” warning is not related to this. It refers to this syntax: @array->[0] (meaning the same as $array[0]). That was never intended to be valid syntax; it slipped into the Perl 5 parser by accident and was deprecated once Larry noticed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry, this may or may not be a programming question directly, but I am
Okay the question title may not have made sense... mostly because I don't know
Sorry the title may not be very clear. Basically I have a wrapper for
Sorry, I know this question is easy, but I don't know how to get
Firstly, sorry about the question title, it may not be very descriptive for my
Sorry for the complete newbie question but i'm not having much luck. I've created
It's my first post so sorry if I may not respect all the conventions
I may be phrasing the question incorrectly based on my situation - sorry if
Hi I am completely new to Java, so sorry if my question may sound
Sorry for question but I can't find answer anywhere on internet. I couldn't find

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.