home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!til!til!tanaka
- From: tanaka@til.til.com (Yokichi Tanaka)
- Subject: Re: Bug in split(/\W+/) with "*" or "+" in input.
- Message-ID: <1992Jul21.235848.24033@til.til.com>
- Sender: tanaka@til (Yokichi Tanaka)
- Nntp-Posting-Host: til
- Organization: Togai InfraLogic, Inc.
- References: <1992Jul17.235506.25157@newsgate.sps.mot.com> <1992Jul18.052238.3430@news.belwue.de>
- Date: Tue, 21 Jul 1992 23:58:48 GMT
- Lines: 28
-
- In article <1992Jul18.052238.3430@news.belwue.de>, wschmidt@commix (Wolfram Schmidt) writes:
- |> In article <1992Jul17.235506.25157@newsgate.sps.mot.com> dichter@chdasic.sps.mot.com (Carl Dichter) writes:
- |> >There seems to be a bug in split, when using repeating whitespace as separator,
- |> >and input data contains apostrophes or plus signs.
- |> >
- |> > ($pt1, $pt2, $pt3, $pt4, $pt5, $pt6) = split(/\W+/);
- |>
- |> Use
- |> ($pt1, $pt2, $pt3, $pt4, $pt5, $pt6) = split;
- |> ($pt1, $pt2, $pt3, $pt4, $pt5, $pt6) = split(/\s+/);
- |> ($pt1, $pt2, $pt3, $pt4, $pt5, $pt6) = split(/[ \t]+/);
- |> if you want to keep the newlines.
- |>
- |> -Wolfram
- |> --
- |> wschmidt@iao.fhg.de Tel.: IAO: 0711/970-2431, Uni: 0711/121-3806
-
- I always use:
- ($x, $y) = split(' ');
-
- Otherwise, leading whitespaces will result in a null first record (unless
- in cases where such behavior is desirable).
-
- --
- Yokichi (Yoke) Tanaka Togai InfraLogic, Inc. "fuzzy"
- tanaka@til.com Irvine, California, USA
- uunet!til!tanaka 714-975-8522
- "The more you drive, the less intelligent you are."
-