in reply to Re: Changing filename extensions
in thread filenames

Forgive me I'm a newbie at Perl, how do I include $dir as part of the path?

Replies are listed 'Best First'.
Re^3: Changing filename extensions
by jwkrahn (Abbot) on Nov 16, 2021 at 03:53 UTC
    rename("$dir/$name.$old", "$dir/$name.$new");

      Given the OP is a Perl newbie, just a further clarification that when running Perl on Windows, forward slashes are preferred to backslashes. This enhances code portability because they work fine in file paths when using Perl on both Unix and Windows (as described in more detail at Re^4: windows perl and paths) and boosts enjoyment because they are easier to type and read than ugly escaped backslashes. :)

      That did the trick, tysm!