in reply to How do i take the first 4 characters of any file name in a specified directory?
@name1 = $nameline;
I am almost certain this line doesn't do what you think it does. There are other ways to solve the problem, but if what you want is to assign all the characters in a string to an array, you can use the split function with an empty regex.
Also, the print on the next line only prints out one of the array elements (specifically, the number 3 element, i.e., the fourth). If you want several elements at once, use slice syntax.