in reply to return an array from File::Find

Your lexical @array within the collect_file-subroutine does not exist outside of that subroutine. It has no relationship whatsoever (other than that they are named the same which is quite confusing) with the lexical @array you declared at the beginning of the script.

The find function does not return the result of the search. May be you were thinking of File::Find::Rule where the find function does return a list of files found. Your script would then become:

use strict; use File::Find::Rule; my @array = File::Find::Rule->new->in($dirphoto);

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James