immediately hinting to you that the \k, \k and \s are being interpolated.Unrecognized escape \k passed through at C:\Data\Perl\Script\Perl-1.pl + line 6. Unrecognized escape \k passed through at C:\Data\Perl\Script\Perl-1.pl + line 6. Unrecognized escape \s passed through at C:\Data\Perl\Script\Perl-1.pl + line 6.
To avoid this, use single quotes:
Of course the answer still 'sucks' ;-)my $name = 'C:\karate\kid\sucks';
This behaviour has nothing to do with the module not "understanding" what shell or OS you are using, the interpolation already happens when you assign "C:\karate\kid\sucks" to the variable. There is no way Perl can know at that moment that this string is a filepath and that it should not use \ as an escape sequence. After all by double-quoting the string you specifically indicated that you want this to be interpolated!
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
In reply to Re: Simple modules
by CountZero
in thread Simple modules
by neutron
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |