Syntactic Confectionery Delight | |
PerlMonks |
Re: What do I do wrong? I want an array of arraysby sk (Curate) |
on Sep 27, 2005 at 18:45 UTC ( [id://495500]=note: print w/replies, xml ) | Need Help?? |
Where am I wrong? almost every line? :)
Let's deal with this by running the program. first trun on strict and
when you run it as is you get this warning Odd number of elements in anonymous hash at nov line 7.<1> Once you change {} to () the code works but it does not do what you want. See $b[0] is a scalar and an array when evaluated under the scalar context returns the lenght of the array so bascially $b[0] = @c; will put 3 into $b[0] or the first element of b. If you want to do 2-D arrays you want to send them as references. The code below does that
output:
hope this helps
In Section
Seekers of Perl Wisdom
|
|