use Win32::OLE ; use Win32::OLE qw(EVENTS); my $shell = Win32::OLE->new('Shell.Application') or die "ERROR ", Win32::OLE->LastError(); $windows = $shell->Windows; $IE = Win32::OLE->new("InternetExplorer.Application") || die "Could not start Internet Explorer.Application\n"; $IE->{visible} = 1; $IE->Navigate('http://www.perlmonks.org'); Win32::OLE->WithEvents($IE,\&Event,"DWebBrowserEvents2"); Win32::OLE->MessageLoop(); $count = 1; sub Event { my ($Obj,$Event,@Args) = @_; print "First Event # $count triggered: $Event\n"; $count++; }