in reply to act on a file list

Hello perl197, and welcome to the Monastery!

Just a side note. The code:

my @file_name; while (<FH>) { push (@file_name, $_); }

can be replaced with the simpler and more idiomatic:

my @file_name = <FH>;

Here is the explanation, from readline:

In scalar context, each call reads and returns the next line until end-of-file is reached, whereupon the subsequent call returns undef. In list context, reads until end-of-file is reached and returns a list of lines.

In your code, while (<FH>) puts <FH> into scalar context1, so the while loop is needed to call <FH> repeatedly until the file is exhausted. But in the simpler version, assignment to an array variable (in this case, @file_name) puts the call to <FH> into list context, so <FH> is called only once and returns a list of all the lines in the file.

Hope this is of interest,

Update: 1Because of the implicit assignment to $_.

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,