1. Here are a couple of ways to do it with Internet Explorer 3.x:

    Here’s one for the ActiveState distribution (5.003, build 306):

    use OLE;
    $ie = CreateObject OLE "InternetExplorer.Application.1" ||
      die "CreateObject: $!";
    $ie->{Visible} = 1;
    $ie->Navigate("http://www.ora.com/publishing/perl/");

    And here’s one for the Perl 5.004 distribution using libwin32:

    use 
                      Win32::OLE;
    Win32::OLE::CreateObject("InternetExplorer.Application.1",       $ie) || die "CreateObject: $!";
    $ie->{Visible} = 1;
    $ie->Navigate("http://www.ora.com/publishing/perl/");

    Here are some ways to solve this exercise (this example uses Microsoft Excel 97—other versions may have slightly different automation objects):

  2. One solution for the ActiveState distribution is:

    use OLE;
         # grab the numbers
         @numbers = <STDIN>;
         # create the automation object
         $xl = CreateObject OLE "Excel.Application" || 
                 die "CreateObject: $!";
         # show it and add a new workbook
         $xl->{Visible} = 1;
         $xl->Workbooks->Add();
         # start at the top left
         $col = "A"; $row = 1;
         foreach $num (@numbers) {
             chomp($num);
             $cell = sprintf("%s%d", $col, $row++);
             # add it to Excel
             $xl->Range($cell)->{Value}  = $num;
         }

    One solution for the Perl 5.004 distribution using libwin32 is:

    use Win32::OLE; # grab the numbers @numbers = <STDIN>; # create the automation object Win32::OLE::CreateObject("Excel.Application", $xl) || die "CreateObject: $!"; # show it and add a new workbook $xl->{Visible} = 1; $xl->Workbooks->Add(); # start at the top left $col = "A"; $row = 1; foreach $num ...

Get Learning Perl on Win32 Systems now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.