This is the best I could come up with. I can't find anyway except for looping through the messages.
Also make sure to import the
in method, because it isn't imported by default.
#! /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";
}
}