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 8234983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:39:16+00:00 2026-06-07T18:39:16+00:00

I read the Programming Perl by By Tom Christiansen, brian d foy, Larry Wall,

  • 0

I read the “Programming Perl” by By Tom Christiansen, brian d foy, Larry Wall, Jon Orwant. There is the following text which I failed to understand (the exact places which I do not understand are marked with bold):

What you really want to know is which operators supply which context
to their operands. As it happens, you can easily tell which ones
supply list context because they all have LIST in their syntactic
descriptions
. Everything else supplies scalar context. Generally,
it’s quite intuitive. If necessary, you can force scalar context
onto an argument in the middle of a LIST
by using the scalar
pseudofunction. Perl provides no way to force list context in context,
because anywhere you would want list context it’s already provided
by the LIST
of some controlling function.

For convenience I would like to formulate the following questions:

  1. What does it mean LIST in the snippet?

  2. What is syntactic description? (seems to be a some sort of documentation)

  3. What does it mean the next text:

you can force scalar context
onto an argument in the middle of a LIST

  • 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-07T18:39:17+00:00Added an answer on June 7, 2026 at 6:39 pm

    It’s quite simple, like the text says. Take a look at perldoc -f print for example:

    print FILEHANDLE LIST
    print FILEHANDLE
    print LIST
    

    Like it says right there, print takes LIST arguments, meaning anything posted after print is in list context. It is the same for any function where the argument(s) are denoted as LIST.

    With the scalar function, you can override this list context, so that your argument is not evaluated in list context. For example, a file handle readline statement such as:

    my $line = <$fh>;
    

    Is evaluated in scalar context, because $line is a scalar. This means only one line is read and put into the variable. However, if you were to do:

    print <$fh>;
    

    The readline is in list context, which means all remaining lines in the file will be read. You can override this by putting the readline statement in scalar context:

    print scalar <$fh>;
    

    And then you will just read one line. To be more precise, you can enforce scalar context in the middle of a list:

    print @list, scalar <$fh>, @list2;
    

    Which presumably is what is referred to in that quote of yours.

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

Sidebar

Related Questions

Almost anywhere I read about programming with CUDA there is a mention of the
I am trying to learn perl programming and am using it to read a
Recently,I read Java Network Programming,in section 5.5,part 5.5.2.6 ,it has the following code: public
I have developed a program which makes use of serial programming to read and
When I read through Programming Perl , 2nd Edition, Page 51, something confuses me
I use visual studio for day to day programming (read putting food in my
I just read the article Programming by Coincidence . At the end of the
Read (skimmed enough to get coding) through Erlang Programming and Programming Erlang . One
I've read the Wikipedia article on reactive programming . I've also read the small
I read that both multiple returns and multiple goto statements are bad programming practice.

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.