#!/usr/bin/perl -w my @files = <*.pl>; # get list of .pl files in this dir my @content; foreach my $file (@files) { if (-f $file && open(FH,"<","$file")) { @content= (@content, ); # add filecontent close(FH); } } # optionally: chomp @content print "$_" foreach @content;