Here is the answer: http://bit.ly/13LE8K0
you can use CPAN List::MoreUtils
use 5.012;
use strict;
use warnings;
use List::MoreUtils qw(indexes);
my @file_paths= qw(
C:\Lazy\FolderA\test.cpp C:\Lazy\FolderA\test2.cpp
C:\Lazy\FolderB\test.cpp C:\Lazy\FolderB\test2.cpp
);
my @ind = indexes {$_ =~ /FolderB/} @file_paths;
say "@ind";
says
2 3