Lists are really a special type of array - .essentially, , a list is a temporary construct that holds a series of values. The list can be "hand" generated using parentheses and the comma operator,

There are many definitions of list, so it's hard to describe what it is. Among other things, it can refer comma separated values in the source (a list literal), the operator produced by that code (a list operator) or the values the operator places on the stack (a list value).

On the other hand, the definition of array is quite clear. First and foremost, it's a type of variable. Very few if any properties are shared between arrays and lists (whichever definition you use) since lists are never variables in Perl.

Is it like when an array is created without any double quotes or single quotes, its called list ?

An array is never called a list. An array is never a list. It may return one. A list may be assigned to one.

In all of your examples, you are assigning a list to an array. You could also say you are initialising an array.

arrays lists vvvvvv vvvvvvvvvv @list1 = (1,2,3,4); @list2 = (list1, list2, list3, list4); @arr1 = ("1" , "2", "3", "4"); @arr2 = ("arr1", "arr2", "arr3", "arr4"); ^ assignments

In reply to Re: difference between array and list in perl by ikegami
in thread difference between array and list in perl by manishrathi

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.