how to have perl repeat the entire sentence with each variable -


#! /usr/bin/perl  @no = (1 .. 20000);  foreach(@no) {  print "<div id=\"world@no\" onclick=\"javascript:showdiv_postscreen(); javascript:hidediv_welcomebuttons()\">&nbsp;</div>\n";  }  

this perl script how re-write sentence new variable each time?

i.e how output

<div id="world1" onclick="javascript:showdiv_postscreen(); javascript:hidediv_welcomebuttons()">&nbsp;</div> . . . <div id="world20000" onclick="javascript:showdiv_postscreen(); javascript:hidediv_welcomebuttons()">&nbsp;</div> 

the @ in print statement confusing interpreter. also, isn't want, since print "@no" print out same thing join(' ',@no). instead, want interpolate each element of @no string that's printed out:

#! /usr/bin/perl  use strict; use warnings; #always use these! @no = (1 .. 20000);  foreach(@no) {  print "<div id=\"world" . $_ . "\" onclick=\"javascript:showdiv_postscreen(); javascript:hidediv_welcomebuttons()\">&nbsp;</div>\n";  }  

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -