use strict;
use warnings;
my $file = $ARGV[0];
open my $fh, '<', $file or die "cannot open $file";
# pause some second to go to inspect the process manager
sleep 5;
# the diamond op <> slurp the whole file when in list context (the array to the left force list context)
my @array_of whole_file = <$fh>;
sleep 5;
####
use strict;
use warnings;
my $file = $ARGV[0];
open my $fh, '<', $file or die "cannot open $file";
# pause some second to go to inspect the process manager
sleep 5;
# the diamond op is now in scalar context
while (my $line = <$fh>){
# do noting
1;
}
sleep 5;
##
##
foreach my $file (@ARGV){
# check it exists..
die "$file does not exists!" unless -e $file;
print "start processing $file\n";
# send the file to your own sub for processing
my_custom_process_sub($file);
...