in reply to weird error when using substring function

You want substr, not sub.

sub introduces a subroutine. Some earlier versions of perl would (unintentionally) abort on bad syntax like you have there, but it should be fixed in current versions.

  • Comment on Re: weird error when using substring function