Next Making Programs Faster 99

Trivial Benchmarks

        Newsgroups: comp.lang.perl.misc
        Date: Wed, 10 Oct 2001 18:59:17 +0400
        Message-ID: <3BC46245.E2B3630A@pisem.net>
        Suppose we have $_="haha:lala:rere";
        What is faster??
        ($haha) = split /:/, $_;  # or
        ($haha) = split(/:/, $_, 1);
        # $_ = "a:b:c:d"
        split /:/, $_, 3;              # ("a", "b", "c:d")
        split /:/, $_, 2;              # ("a", "b:c:d")
        split /:/, $_, 1;              # ("a:b:c:d")
        ($haha) = split /:/, $_;       # ("a", "b:c:d")

Next Copyright © 2003 M. J. Dominus