use 5.010; say for glob '*.c'; # or if you're doing more than using the filename once .. for my $file ( glob '*.c' ) { print $file, "\n"; lots_of_complicated_code( $file ); }