Hi monks, I am trying to work on a bit of code that uses multidimensional arrays to store the coordinates for an imagemap and then accesses these coords to insert the links.

However, my code doesn't work. When i try to print the value of the $coords variable, it returns an array reference, not a number - which makes me think I am accessing the values wrong.

Any advice would be lovely ;->

# @numbers contains numerical data # @links contains the name of the file where the graph is my @coords = (undef, [13,9,6], [29,9,7], [44,9,6], [59,10,6], [75,9,7] +, [91,10,5], [106,9,7], [122,9,7], [137,9,7], [152,10,6], [169,9,7], +[184,9,6]); for my $goal ( 1..12 ) { for my $well ( @numbers ) { my $img = ( $well == $goal ) ? $links[$goal-1] : "array.bmp"; my $coords = join ',', ${coords[$goal]}; # print "COORDS: @coords<P>"; print qq(<area href="http://host/cgi-bin/temp/$img" ALT="" shape="circle" coords="$coords">); } }

In reply to accessing values from multidimensional arrays by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.