in reply to Re: Re: split trying to look for /
in thread split trying to look for /

The first argument to split() is always a regular expression

Has this always been true? I remember a time long ago when I tried to use split "\n", "foo\nbar"; and got an error stating that using double quotes to split on a newline was wrong and that split /\n/, "foo\nbar"; should be used. I just tried a one-liner with warnings and strict enabled and did not get that same warning/error. Would you know why using double quotes used to give funny results?

Replies are listed 'Best First'.
Re: Re^3: split trying to look for /
by duff (Parson) on Dec 17, 2003 at 02:08 UTC

    I have never seen nor heard of such behavior before, so I can't answer that. However, as to whether it's always been true that the first arg to split() is always a regular expression ... it's been true at least since perl 4 :-)