# For foo.htm => foo.htm.tmp opendir( HTMLSTORIES, "$html_dir") || die "HTML files do not exist: $!"; @FigureArray = grep{/\.htm$/} readdir ( HTMLSTORIES ); foreach $figfile (@FigureArray) { copy ($figfile, "$figfile.tmp") or die "Can not make temporary copy of file [$figfile]: $!"; }