Take the 2-minute tour ×

In a situation where cygwin and a non-cygwin perl installation coexist, I am having touble setting the PATH from cygwin, so perl is happy with it.

The trouble is that perl seems to expect DOS-style PATHs, i.e. with a leading drive letter and directories separated by semicolons (it accepts forward slashes though). E.g.


Cygwin wants unix-style paths and does not like drive letters, particularly the colon after the drive letter, because the colon separates directories. For directories containing a drive letter, cygwin wants them like this:


I understand that perl cannot be happy with such paths, because it is a cygwin internal convention and perl is unaware of cygwin.

Why this matters to me

I used to believe that PATH is irrelevant for perl, as long as the perl executable can be found, which I can always achieve by calling it with its full path. But I recently installed XML::LibXML in my Strawberry perl installation. When I run a perl program, which includes a

 use XML::LibXML;` 

I get the error

Can't load 'D:/Software/Strawberry/perl/site/lib/auto/XML/LibXML/LibXML.dll'

LibXML.dll does exist and it is in the directoy listed in the error message and is readable.

I was told to add the strawberry\perl\bin and Strawberry\c\bin directories (both located under D:\Software) to my PATH. This does fix the problem, however I cannot do this from a cygwin bash script for the reasons described above. In a cmd file this works fine.


  • Is there a way I can set the PATH from cygwin, so Strawberry perl is happy with it?
  • Was it maybe a bad advice to add those two directories to my path and there is a more straighforward way of solving the "Can't load" problem?
share|improve this question
I had success with setting up a symlinks. In different situations I have had either a windows symlink (its called something else) or a cygwin set symlink to /usr/bin/perl so that my scripts would run with #!/usr/bin/perl. Most recently I settled on one installation of perl and set my win path with C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin; –  Qoheleth-Tech May 31 '13 at 5:25
add comment


Your Answer



Browse other questions tagged or ask your own question.