G'day Hasharray,

Welcome to the monastery.

This technique appears to do what you want.

$ perl -Mstrict -Mwarnings -e ' my $X_initial = "80"; my $Y_initial = "80"; my $MAX_X = 240; my ($cur_x, $cur_y) = ($X_initial, $Y_initial); for (0 .. 20) { if ($cur_x > $MAX_X) { $cur_x = $X_initial; $cur_y += $Y_initial; print "\n"; } print " \t$_:$cur_x/$cur_y"; $cur_x += $X_initial; } print "\n"; ' 0:80/80 1:160/80 2:240/80 3:80/160 4:160/160 5:240/160 6:80/240 7:160/240 8:240/240 9:80/320 10:160/320 11:240/320 12:80/400 13:160/400 14:240/400 15:80/480 16:160/480 17:240/480 18:80/560 19:160/560 20:240/560

I'll leave you to translate that into your XML-populating code.

-- Ken


In reply to Re: Using a calculation to place locations by kcott
in thread Using a calculation to place locations by Hasharray

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.