Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^4: Given When Syntax

by Anonymous Monk
on Mar 17, 2014 at 23:38 UTC ( #1078705=note: print w/replies, xml ) Need Help??

in reply to Re^3: Given When Syntax
in thread Given When Syntax

The advantages of push/pop are mentioned in the second footnote on page 49 in the 6th edition:

You could add new items to the end of an array by simply storing them as elements with new, larger indices. But real Perl programmers don’t use indices.*

* Of course, we’re joking, but there’s a kernel of truth in this joke. Indexing into arrays is not using Perl’s strengths. If you use the pop, push, and similar operators that avoid using indexing, your code will generally be faster than if you use many indices, and you avoid “off-by-one” errors, often called “fencepost” errors. Occasionally, a beginning Perl programmer (wanting to see how Perl’s speed compares to C’s) will take, say, a sorting algorithm optimized for C (with many array index operations), rewrite it straightforwardly in Perl (again, with many index operations) and wonder why it’s so slow. The answer is that using a Stradivarius violin to pound nails should not be considered a sound construction technique.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1078705]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2019-04-25 16:25 GMT
Find Nodes?
    Voting Booth?
    I am most likely to install a new module from CPAN if:

    Results (127 votes). Check out past polls.

    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!