Reading the contents of a directory: change to that directory and then use the glob command
# @list = glob(expression);
# The expression needs to be a shell-style wildcard, such as *.pl for all file names ending in .pl.
#!/usr/bin/perl -w
@list = glob("*.pl");
print ".pl files: @list";