Hi there again :)
I was wondering why this doesnt work. I have an array of numbers. I use a while loop as follows to split the array.
@array = $_;
@array = split;
This splits the array via new line. Every element of the array holds a string of numbers. The element $array for example might contain the following data.
12 44 111 445
The numbers are separated by tabs.
I now want to get at individual numbers from the element $array. So, I attempted the following.
@line1 = $array;
print "@line1\n"; # this works
@line1 = split(/\t/);
$var1 = $line1;
print "$var1\n"; # this doesnt work
$var1 doesnt print. Could anyone please tell me why and what I could try to rectify this? Thanks
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.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||