Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Observation 2 illustrates a danger

by tilly (Archbishop)
on Aug 22, 2001 at 09:37 UTC ( #106883=note: print w/replies, xml ) Need Help??

in reply to Re: compilation errors???
in thread compilation errors???

In C one of the most common errors to make is an off-by-one error. If you use explicit for loops in Perl, you will make the same error just as often. This is a good reason to use foreach loops whenever possible.

I mention this because your second observation has an off-by-one in it. The odds of an off-by-one can be reduced, though, by:

foreach my $i (0..$#filenames) { # ... }
since that removes an inequality that people may miswrite. An even cleaner solution is offered by tye at mapcar -- map for more than one list.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (1)
As of 2021-02-25 02:51 GMT
Find Nodes?
    Voting Booth?

    No recent polls found