Welcome to the monastery.
In your code, $rocks and @rocks are two entirely different variables. Variables with a $ are scalar values; those with an @ are arrays.
When you use brackets () in the manner shown in your code, you are creating a reference to an array (typically just called an arrayref) - that's what ARRAY(0x1434d80) is referring to. You can also get a reference to an array by putting a backslash in front of the array name (e.g. \@array_name).
You can access elements of an array with this syntax: $array_name[index] (where index is an integer). You can access elements of an arrayref with this syntax: $array_ref->[index] (again, index is an integer).
Here's an extension to the code you posted showing all of these:
$ perl -le '
$rocks = [1..23];
@rocks = qw/hail slate poop drop/;
Have a read through these documentation pages for a more in-depth description: perlintro, perldata and perlref.
You should also declare your variables. my is the most frequently used way of doing this - perlsub has a lot more information about this and other ways to declare variables.
In addition to use warnings;, you should also add use strict; to the start of your code: this is one of the first things you'll read about in perlintro; details can be found in strict.
Finally, if you just want to "get some interaction going with my fellow Monks", you can use the Chatterbox (typically referred to as the CB) which should be on the panel to your right.
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:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||