Hello Monks,
I am trying the following example:
#!/usr/bin/perl
use warnings;
use strict;
my @refarray1 = (qw[this is the first line],
qw[Second one is here],
qw[squint your eyes to see the third],
qw[fourth is surely near],);
print "$refarray1[0]\n";
my $refarray2 = [qw[this is the first line],
qw[Second one is here],
qw[squint your eyes to see the third],
qw[fourth is surely near],];
print "$refarray2->[0]\n";
Both produce the same result, the output is it prints out the word "this".
What do I do if I want to print out the entire contents of one of the elements? I dont mean the whole four lines, but say, I just want to print out one line, how do I do that in case I have created an array of references or an array reference to a reference of arrays (whee, I'mgetting wordy here, and confused too)
Perl Version - (v5.14.2) built for MSWin32-x86-multi-thread
on Windows 7 64 Bit. (Purposely using 32 Bit Perl)
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.