#!/usr/bin/env perl
use strict;
use warnings;
use autodie;
{
open(my $first_fh, "<", "file1.txt");
my @file1_lines = <$first_fh>;
}
{
open(my $second_fh, "<", "file2.txt");
while (my $line = <$second_fh>) {
my @data = my_sub($first_fh, $line);
}
}
sub my_sub { 1 }
####
Global symbol "$first_fh" requires explicit package name ... line 16.
Execution ... aborted due to compilation errors.
####
Can't open 'file1.txt' for reading: 'No such file or directory' ... line 8