little samie

Index   Next   Previous

use Win32::OLE;
use Win32::SAM;
#use Win32::Slingshot;

$| = 1;
my $URL = "http://www.google.com/";
my $seconds;

$Win32::OLE::Warn = 3;

StartIE();
$seconds = Navigate($URL);
print "Google Page took $seconds seconds to load\n";
SetEditBox("q","Presidents");
$seconds = ClickFormButton("btnG");
print "Query Page took $seconds seconds to load\n";


Going through the code line by line...

my $seconds;

The dollar sign ($) before characters tells the Perl Interpreter that you are defining or using a scalar.  In this case we are defining one named $seconds.  A scalar can represent any primitive data type such as an Integer of any size, a Real Number (decimals) or a string (characters).

The keyword my is used to define the scope of the scalar variable $seconds.  It says that $seconds can only be seen by code used in this script that is outside of a subroutine definition.  Since there are no subroutines defined in this script it is not really necessary to use "my" in this case.  The script will run fine without it, but it's good practice to use it.

The scalar $seconds will be used to hold the number of seconds it takes to load a page while the script is running.

Index   Next   Previous

little samie