@FILES = ( 1, 2, 3 ); foreach $FILE (@FILES) { # Open filehandle tailing file written by ssh

open ( ${fh.$FILE}, "tail -f file$FILE |") || die "can't open file$FILE"; while ( ${line.$FILE} = ${fh.$FILE} ) { # Here I do my split on the CSV line and assign to arrays (keeping the # $FILE value as a suffix to the array name)

@{fields.$FILE} = split(/,/,${line.$FILE}); push @{AAA.$FILE}, ${fields.$FILE[0]}; # .....