Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hello raygun,

in effect the difference is subtle and can fade into equivalence, but see it from this point of view: a list is not a Perl data type. Perl has three main variable types: scalars, arrays, and hashes. (perlintro).

In Learning Perl - third edition is stated this way:

> A list is an ordered collection of scalars. An array is a variable that contains a list. In Perl, the two terms are often used as if they're interchangeable. But, to be accurate, the list is the data, and the array is the variable. You can have a list value that isn't in an array, but every array variable holds a list

Sometimes, just to make things more foggy, you can do operations on list in the same way as you do with array:

 print +( qw(J A P H) )[2] prints P

but you cant shift a list and the doc goes: shift ARRAY but for example print accepts a list: print LIST

Another key concept is LIST in respect of context and here it overlaps with array: LIST or SCALAR context: in list context you can assign it to an array, but again, the array is the perl variable and the list is its value.

See also: What is the difference between a list and an array? and Scalars, Lists, and Arrays


There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

In reply to Re^5: Seeking Perl docs about how UTF8 flag propagates - lists and arrays by Discipulus
in thread Seeking Perl docs about how UTF8 flag propagates by raygun

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-04-14 17:29 GMT
Find Nodes?
    Voting Booth?

    No recent polls found