in reply to Phantom "No such file" issue

Hello ImJustAFriend,

Because you haven’t explicitly stringified the expession $provinfile.$server, the dot functions as a concatenation operator. So the result is a string, but there is no dot character inserted between the two strings. This is obscured by the error message, which does contain an inserted dot character.

Update: It’s good practice to ensure that an error message reflects exactly what’s happening. Here, you can accomplish this with an extra assignment:

for my $server (@servers) { my $full_path = $provinfile . '.' . $server; # or = "$provinfil +e.$server"; open IN2, '<', $full_path or die "Could not open Server IN2 ($full_path): $!\n"; ... }

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Replies are listed 'Best First'.
Re^2: Phantom "No such file" issue
by ImJustAFriend (Scribe) on Nov 02, 2018 at 14:27 UTC
    Worked like a dream, thank you!