Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Searching for two elements in two different lines

by Eily (Parson)
on Aug 30, 2013 at 12:45 UTC ( #1051622=note: print w/replies, xml ) Need Help??

in reply to Searching for two elements in two different lines

Your code is hard to read, and I only say hard because I gave up too early to end up saying impossible.

If you have too many variables with names ending with a number, there's probably a design problem. In your case that's already obvious with the files. Either all three of them have the same role, and one can be used as the other without the whole program losing all its sense, and you can store their name and filehandles in an array or whatever data structure seems the best. Or your files have different purposes and you should give them names accordingly.

The same goes for arrays, you can't have 8 of them called "array" and use them for 8 different purposes.

As a rule, you should try to name your things by what they mean and not what they do. An array of colour names should be @colour, not @array. And how the hex do you end up with more than one kind of nothing?

And Perl warns you for a reason, because code that seems to work but has unexpected behaviour is actually worse than code that doesn't work but explicitly fails. So the first optimisation is use warnings

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1051622]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2018-01-22 02:36 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (230 votes). Check out past polls.