in reply to Re: Why doesn't this work?
in thread Why doesn't this work?

Huh?... but the 2nd one worked. What did you do to your perl that it doesn't? I'm using this split:
Splits the string EXPR into a list of strings and returns the list in list context, or the size of the list in scalar context. Size of list in scalar context. && re: limit: If LIMIT is omitted (or, equivalently, zero), then it i +s usually treated as if it were instead negative but with + the exception that trailing empty fields are stripped (empt +y leading fields are always preserved);
What version of split are you using?

Replies are listed 'Best First'.
Re^3: Why doesn't this work?
by Corion (Patriarch) on Apr 12, 2013 at 22:05 UTC

    Ah, sorry - I don't know what I did wrong while testing this. The documentation is correct and neither the limit nor the forced list context are needed:

    > perl -e "{$/=undef, $_=<>} my $count=split /\n/; print $count" \boot +.ini

    works just as well, and just as documented.