Guidance:
-
use <code> tags to make your code legible on this site (see Writeup Formatting Tips).
-
Always "use strict;" and "use warnings;"
-
Use the 3-parameter form of "open", AND do error checking:
open my $handle, "<" , "My-file-name" or die "Could not open File-name:$!";
-
Dont use "&" for subroutine calls (old style), unless you know what you are doing.
- "ls" will not return the FULL PATH - just the file names, so you may need to append the path before opening the file.
We can help you more after you post readable code...
Update: Typo fixed, Thanks, MidLifeXis.
"You're only given one little spark of madness. You mustn't lose it." - Robin Williams