in reply to Re: reading from directory
in thread reading from directory

Since there is More Than One Way To Do It, you could also go for the object-oriented approach using DirHandle:
use DirHandle; my $dh = new DirHandle; $dh->open( 'MainDir' ); foreach ( grep /\.cpp$/, $dh->read ) { # do stuff } $dh->close;
The DirHandle module is a wrapper around opendir and its relatives, so this is essentially the same as CubicSplines answer, just another way of writing it.

Cheers,
--Moodster