#! /usr/bin/perl use strict; use warnings; use Win32::OLE qw( in ); #Outlook Application creation my $outlook = Win32::OLE->CreateObject('Outlook.Application'); my $ns = $outlook->getNamespace('MAPI'); my $inbox = $ns->GetDefaultFolder(6); #String to match my $match_str = 'test'; #Search the items foreach my $item (in $inbox->Items){ if($item->{Subject} =~ /^$match_str/i){ print "$item->{Subject} matches\n"; } }