P is for Practical | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Greetings all,
A few suggestions... To access the variables that reside in your @number array you will need to refer to them as scalars so $number[0] would give you the first element of your array. To get the size of your array use scalar @number Now going through an array can be accomplished in a myriad of different ways but here are two of the more common ones aside from the while loop you already have. One last thing if you are looking for number ending in some sequence of digits, in this case '9432' you do not need to use the ^ anchor, just the $ anchor, since the ^ indicates to the regexp engine that you are checking from the beginning of the string. The $ indicates the end of the string, so your pattern would be /9432$/ since you are trying to match the end. I hope that helps. -InjunJoel
"I do not feel obliged to believe that the same God who endowed us with sense, reason and intellect has intended us to forego their use." -Galileo
In reply to Re: help manipulating data in an array.
by injunjoel
|
|