#!/usr/bin/perl -w use strict; use warnings; my $folder= "oem"; my $file = "./oem.h"; open my $fh, $file or die $!; my @array = <$fh>; close $fh; my @content = grep {/\Q$folder\E/} @array; print "@content";