perl(1) question

Ben Smithurst ben at
Mon Sep 4 02:01:00 BST 2000

Paul Richards wrote:

> Since in the above code is trying to match against $_ which is
> undefined the result will always be "" which never matches anything so
> index() always returns 0.

nitpick: "" always matches right at the start of the string, which is
why the offset is zero.  If a match isn't found, index() returns -1.

Ben Smithurst / ben at / PGP: 0x99392F7D

More information about the Ukfreebsd mailing list