### #Use the unix ls command to list the jpg files in the subdirectory ### use Shell(ls); @array = ls *jpg ; ### #Set the TotFiles scalar to the value number of elements in @array ### $TotFiles = @array + 1; print "Value of TotFiles is: $TotFiles \n"; ## #create four digit padding for the frames with a for loop ## for( $loop = 0; $loop <= $TotFiles; $loop++ ) { if ($loop < 10) { $padder = '000'; } if (($loop > 10) && ($loop < '100')){ $padder = '00'; } if (($loop > 100) && ($loop < 1000)) { $padder = '0'; } if ($loop > 1000) { $padder = ''; } ## #create a new name using the padder and the loop number ## $new = "snowscene"."."."$padder"."$loop".".jpg"; print "$new \n"; $old = @array[[$loop]] ; print $old; rename ($old, $new) ; }