in reply to Re: Rogue Null (ordinate 0) characters in text files
in thread Rogue Null (ordinate 0) characters in text files

split /\.*/ results in you only checking the first character of every line and the ones after periods

What you describe would happen with /\.+/  — as long as there are no periods, /\.*/ does split up individual characters just like //.   (Not saying that it should be used here, though...)

Replies are listed 'Best First'.
Re^3: Rogue Null (ordinate 0) characters in text files
by Thelonius (Priest) on May 08, 2008 at 01:14 UTC
    > as long as there are no periods, /\.*/ does split up individual characters just like //. No, it doesn't.
    @c = split /\.+/, "abcdefg"; @d = split /\.+/, "ab.c.....defg";
    results in @c having one element, "abcdefg", and @d having 3 elemnts, "ab", "c", and "defg".

      Well, you're using /\.+/, not /\.*/  :)

      my $s = "abcdefg"; my @c = split /\.*/, $s; print '/\.*/: ', join("-", @c), "\n"; my @d = split //, $s; print '//: ', join("-", @d), "\n"; __END__ /\.*/: a-b-c-d-e-f-g //: a-b-c-d-e-f-g