#! /usr/bin/perl # This one works sub main { @total1 = get_dir("\\\\RICH0417\\d\$\\wirein"); @total2 = get_dir("\\\\RICH0418\\d\$\\wirein"); @total = (@total1, @total2); open (F, ">E:\\wirecount.txt")|| die("Cannot open file."); print F ($#total + 1); close F; print STDOUT "."; sleep 30; main(); }