Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^7: Compare three columns of one file with three columns of another file in perl

by aaron_baugher (Curate)
on May 26, 2015 at 17:19 UTC ( [id://1127861]=note: print w/replies, xml ) Need Help??


in reply to Re^6: Compare three columns of one file with three columns of another file in perl
in thread Compare three columns of one file with three columns of another file in perl

You're welcome, you did a good job of turning my pseudo-code into working code!

One suggestion: don't create variables outside a loop if they're only used within the loop. So your @array1 can be instantiated inside your first loop, like this:

my @array1 = split (" ", $_);

Same thing with @array2, $str, and $string. The way you're doing it will work, but it may introduce bugs in more complicated code, because those variables will continue to exist after those loops are finished, and could conflict with other uses elsewhere. It's best to keep variables inside as small a context as possible, so only create them outside a loop if you need them to continue to exist after the loop is finished.

Aaron B.
Available for small or large Perl jobs and *nix system administration; see my home node.

Replies are listed 'Best First'.
Re^8: Compare three columns of one file with three columns of another file in perl
by anonym (Acolyte) on May 27, 2015 at 16:28 UTC

    Thanks Aaron for your suggestions and help. Thanks so much.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (6)
As of 2024-04-23 10:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found