diff --git i/lib/XML/XSH2/Functions.pm w/lib/XML/XSH2/Functions.pm
index 060c7c4..09de64b 100644
--- i/lib/XML/XSH2/Functions.pm
+++ w/lib/XML/XSH2/Functions.pm
@@ -1246,7 +1246,8 @@ EOS
   } else {    
     print STDERR "Saving compiled '$SCRIPT' to '$DUMP'\n" unless $QUIET;
     open my $f, ($DUMP_APPEND ? '>>' : '>'), $DUMP || die "Can't dump parse tree to '$DUMP': $!";
-    print {$f} "#!/usr/bin/env perl\n" unless $DUMP_APPEND;
+    require Config;
+    print {$f} "$Config::Config{startperl}\n" unless $DUMP_APPEND;
     print {$f} $dump;
     close $f;
     chmod 0755, $DUMP unless $DUMP_APPEND;
diff --git i/xsh w/xsh
old mode 100644
new mode 100755
index 42105a4..fc406d1
--- i/xsh
+++ w/xsh
@@ -1,4 +1,4 @@
-#!/usr/bin/env perl
+#!/usr/bin/perl
 # -*- cperl -*-
 
 # $Id: xsh,v 2.9 2007-04-24 15:02:20 pajas Exp $