foreach my $temp_line(@store_files) { if(my $pattern =~ /^REVISION_LOCATION:/){ #### #!/usr/bin/perl use strict; use warnings; my $dir = shift // '.'; opendir my $dh, $dir or die "Could not open '$dir' for reading '$!'\n"; my @things = grep {$_ ne '.' and $_ ne '..'} readdir $dh; foreach my $thing (@things) { if(my $pattern =~ /^test/){ print $thing . "\n"; } } closedir $dh or die "Could not close dir hanlde '$dh': '$!'\n"; __END__ Monks$ perl test.pl Use of uninitialized value $pattern in pattern match (m//) at test.pl line 11. Use of uninitialized value $pattern in pattern match (m//) at test.pl line 11. #### #!/usr/bin/perl use strict; use warnings; my $dir = shift // '.'; opendir my $dh, $dir or die "Could not open '$dir' for reading '$!'\n"; my @things = grep {$_ ne '.' and $_ ne '..'} readdir $dh; foreach my $thing (@things) { if($thing =~ /^test/){ print $thing . "\n"; } } closedir $dh or die "Could not close dir hanlde '$dh': '$!'\n"; __END__ Monks$ perl test.pl test.pl~ test.pl