#! /usr/bin/perl -w use strict; use File::Copy; # pass directory to scan as arg1 (default to current dir) my $dir = shift || "./" ; # get list of non-hidden files in directory opendir(DIR, $dir) || die "can't opendir $dir $!"; my @files = grep { /^[^.]/ && -f "$dir/$_" } readdir(DIR); closedir DIR; my %images = (); # process each file foreach my $file (@files) { next if ($file =~ /\.pl/) ; # skip perl program files copy($file, "$file.bak"); chmod 0600, $file; my $img = ''; my $fig = ''; open(FH,"<$file") || die "couldn't open $file for read: $!\n"; while () { chomp ; s/^\s*|\s*$//g; # strip leading and trailing spaces if (/