Is -C useless?

Paul LeoNerd Evans leonerd at
Thu Sep 11 13:11:58 BST 2008

Consider the following:

  #!/usr/bin/perl -COL

  print "Hello w\xe9rld\n";

  $ perl 
  Too late for "-COL" option at line 1.

WTF?? If that's "too late", where else can I put it?

If I remove it from the file:

  $ perl -COL
  Hello wérld

But of course now STDOUT isn't UTF-8.

  $ perl
  Hello w�ld

This can be fixed by:


  binmode STDOUT, ":utf8" if $ENV{LANG} =~ m/\.UTF-8$/;

  print "Hello w\xe9rld\n";

  $ perl
  Hello wérld

But of course, this is the exact behaviour that -COL is supposed to
provide; and yet is "too late" by the shebang time.. Yet, clearly not
because I can do it even later at runtime.

Can anyone offer any insight here?

Paul "LeoNerd" Evans

leonerd at
ICQ# 4135350       |  Registered Linux# 179460
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url :

More information about the mailing list