First, please use <c>code goes here</c> tags around your code. It makes sure the code is displayed properly regarding HTML entities, easily distinguished, and easily downloaded for editing.
Second, if that's your actual code then you're missing at least two semicolons. Perl is not a text-line terminated language like some forms of Basic. You need to end your statements with semicolons. (Technically, in Perl, semicolons separate statements but that's a superfluous distinction at the moment.)
Third, the line
I don't think is doing what you expect it to do. That will give you warnings, because you actually are throwing away a bunch of data there. Perhaps you mean @list instead of $list (which would be the common case for taking the value of an anonymous list and seems to be what you're wanting later in your code and by the name of the variable "list").my $list = (2,3,4,5,6);
There are ways to get data about a list into a scalar, but that's not what you seem to want. Also, you can put a reference to an array (even an anonymous array) into a scalar and get data through the reference, but that's not what the rest of your code is set up to do, either.
In reply to Re: Perl Lists and Arrays
by mr_mischief
in thread Perl Lists and Arrays
by sarathi.mh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |