laffingpc has asked for the wisdom of the Perl Monks concerning the following question:

I want to open PDF files that are in an array without having to click any buttons. Everything I have tried has failed. Here is my code:
@currentfiles = sort { uc($a) cmp uc($b) } @currentfiles; for($aa = 0; $aa <= int($#currentfiles / 1); $aa++){ if ($currentfiles[$aa]=~ /$varname/) { @allFilesList = $currentfiles[$aa]; print qq~ <font color="#0000ff"><b>&#149;</b> <a href="$folder/$currentfiles[$aa]" target="_blank">< +font color="#0000ff">$currentfiles[$aa]</font></a></font><br> ~; } }
Instead of links I want the files to open. I don't want code, just the command that does this. Thanks

Replies are listed 'Best First'.
Re: Open PDF file on load
by moritz (Cardinal) on Aug 11, 2009 at 17:06 UTC
    You can't. The browser expects one document per HTTP request, and will be confused if you try to do anything else.
Re: Open PDF file on load
by zwon (Abbot) on Aug 11, 2009 at 17:23 UTC

    Perhaps you can do it with javascript that will download and open all PDFs.

      The problem is Javascript can't read the array. I used this
      $filecount = @allFilesList; <script type="text/javascript"> function OpenAllFiles() { for (i = 0; i < $filecount; i++) { window.open ("$folder/@allFilesList[i]", + i, "_blank"); } } </script>
      it just opens the first file the number of times of filecount. Thanks for the help.
        Javascript can't read the array

        Why don't you just create n window.open(...) statements with the appropriate URIs on the Perl side, and send the resulting JS to the browser?  (wrapped in <script> tags, of course)