CyberTiger wrote:
> I had this one recently... turned out to be a windows linefeed at the end
> of the hashbang.

Yep, that's it.  I managed to get both scripts looking identical but with
one failing and one OK.

bad.pl

  #!/usr/bin/perl
  print "bad\n";

good.pl

  #!/usr/bin/perl
  print "good\n";

'diff -u good.pl bad.pl' tells me this:

  -#!/usr/bin/perl
  -print "good\n";
  +#!/usr/bin/perl
  +print "bad\n";

And 'od' reveals the problem:

[abw@kickflip ~/perl/hacks/goodbad] od -c good.pl 
0000000   #   !   /   u   s   r   /   b   i   n   /   p   e   r   l  \n
0000020   p   r   i   n   t       "   g   o   o   d   \   n   "   ;  \n
0000040
[abw@kickflip ~/perl/hacks/goodbad] od -c bad.pl 
0000000   #   !   /   u   s   r   /   b   i   n   /   p   e   r   l  \r
0000020  \n   p   r   i   n   t       "   b   a   d   \   n   "   ;  \r
0000040  \n
0000041

And there it is - the \r DOSsy carriage return.

DOS sucks.  Bill Gates is the Antichrist.  Moveable Type is a pain in the 
ass to install and Grey Matter is no better.  All software sucks.  War 
is inevitable (between France and the USA if nothing else) and the sky is 
falling in.

Apart from that, everyone have a nice day :-)

Thanks for the help
A

(founder of Doom::Mongers.pm)


Reply via email to