Use the diamond operator to read from an opened file handle:
open my $FH, '<', '/path/to/spool.txt' or die $!;
while (my $line = <$FH>) {
print "I've read: $line";
}
close $FH;
1
solved I want to read a file from a directory folder [duplicate]