How to get perl script to generate every combination of two variables -
#! /usr/bin/perl use strict; use warnings; #always use these! @no = (1 .. 100); foreach(@no) { print "\#world" . $_ . " \{ background: url(/images/1.png) 0 0 no-repeat; float: left; width: 1%; height: 2%; position: absolute; top: " . $_ . "\%; left: " . $_ . "\%; z-index: -1; margin-top: -10px; margin-left: -10px; \} \#world" . $_ . ":hover \{ background-position: 0 -20px; cursor: pointer; \}"; }
currently perl script outputs #world1, top: 1%; left: 1%;
percentages same. how can modify script output world(1 through 100) top: 1%; left: (1% through 100%)%; world(101 through 201) top: 2%; left: (1% through 100%)%;
world(19001 through 20000) top: 100%; left: (1% through 100%)%;
this add unique number $world
every top/left value pair.
my $world = 1; $top (1 .. 100) { $left (1 .. 100) { # print here... world$world top = $top, left = $left... $world++; } }
Comments
Post a Comment