in reply to No Such File or Directory Error

"@lines[k]"

will NEVER work. you need to tell perl k is a variable by putting a dollar sign in front of it and as I explained in your previous post, you need to access an array element as a scalar. that is:

$lines[$k]