in reply to How to Open Files from Subdirectory

Is it not your path to the files? If I look at your file structure and the location of the files the path should be different. Also if you print your scalars you would notice that the $file_sec comes back different then expected. In your case it would result in:

$file: "/files/data.pri"
$file_sec: "/files/files/data.sec"

This should do what you want:

# mycode.pl my $file = "files/data.pri"; my $name = (split(/\./,$file))[0]; my $file_sec = "$name.sec";
prints now:

$file: "file/data.pri"
$file_sec: "file/data.sec"

hope this helps,

Critter