Opening new browser windows using Perl


From my Perl program I want to open several new browser windows and load different HTML pages, whose URLs I have.
How can this be done?
leoleoAsked:
Who is Participating?
 
helverConnect With a Mentor Commented:
print <<Opens;

<SCRIPT LANGUAGE="JavaScript">

<!--

window.open(\"$url1\", window1);
window.open(\"$url2\", window2);

// -->

</script>

Opens
;
0
 
jhurstCommented:
I would agree with the above except that it does have the problem that it is not really a perl solution and does require that the user has JS enabled.  But, I have nothing better to suggest.
0
 
leoleoAuthor Commented:

 I have tried this. But there was a problem when I tried reading the URLs from an array. The array has some values like,
 @urls = ('url1', 'url2', 'url3');

 Instead of giving separate window.open() statements, I want to use a loop inside the Javascript. The number of urls in the array may vary depending on the input from the html.
 
 How can this be done?
0
 
ozoCommented:
print <<Opens;

<SCRIPT LANGUAGE="JavaScript">

<!--

@{[map {qq{window.open("$_", window}.(/(\d+)/,$1).");\n"} @urls]}

// -->

</script>

Opens
0
All Courses

From novice to tech pro — start learning today.