#!/usr/bin/perl -w use strict; # 1190936 my @sourcefiles = ; for $_(@sourcefiles) { if ($_ =~ /.+?\.txt/ ) { # process it here -- simulated by; print $_; } else { next; } } __DATA__ foo.bar bar.txt baz.bat blivitz.txt; nottext and somethingelse.txt