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()\"> </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()"> </div> . . . <div id="world20000" onclick="javascript:showdiv_postscreen(); javascript:hidediv_welcomebuttons()"> </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()\"> </div>\n";  }  
Comments
Post a Comment