in reply to Using a calculation to place locations
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Using a calculation to place locations
by Hasharray (Novice) on May 07, 2013 at 17:50 UTC |
In Section
Seekers of Perl Wisdom