while (my $file = <$path*>) { $file =~ s/$path//; push @filearray, $file; }