With the second script you don't have to know what the path separator is. That is, the main thing that File::Spec provides is
. You can use
and it will work on whatever platform the script is run on.
A more useful example for comparison between unix and windows would be the return value of File::Spec->devnull().
Check out the File::Spec documentation (for which you provided a link :-) for more details.