Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re^3: correlation between two inputt files

by aaron_baugher (Curate)
on Apr 27, 2012 at 15:17 UTC ( #967666=note: print w/replies, xml ) Need Help??

in reply to Re^2: correlation between two inputt files
in thread correlation between two inputt files

Feel free to contact me to arrange payment...

#!/usr/bin/env perl use Modern::Perl; my @p; open my $fd2, '<', 'INPUT_FILE2.TXT' or die $!; while(<$fd2>){ next if /#/ or ! /\w/; my( $p, $n ) = split; push @{$p[$n]}, $p; } close $fd2; open my $fd1, '<', 'INPUT_FILE1.TXT' or die $!; while(<$fd1>){ next if /#/ or ! /\w/; my( $r, $n ) = split; say "reactant: $r, product: $_" for @{$p[$n]}; } close $fd1;

Aaron B.
My Woefully Neglected Blog, where I occasionally mention Perl.

Replies are listed 'Best First'.
Re^4: correlation between two inputt files
by himanshuyadav on Apr 27, 2012 at 16:02 UTC
    dear sir, great thanks on your reply.I am a B.Sc 1st year student in India.This script is needed for our Biochemistry project. It is giving slightly different result.It will be great if you can look into it and modify it according to desired output. waiting for your reply. Thank you.
      Right after you send me (privately, so I can make a ton of $$$ off it) a cure for cancer.

      That should be right up a BioChem major's alley.

      Alternately, send me a contract assigning to me all your future patents, proceeds of royalty agreements, and salary.

      Since you don't say what you want different about the results, I couldn't modify it if I wanted to. In your sample, you show it outputting the reactants in the order E, C, A, B, and since that doesn't match the order from the file or alphabetical order, I have no idea what you're shooting for there.

      I already did 99% of the work on spec. If you're trying to learn Perl, figuring out the last 1% will be good practice. If you're not interested in learning Perl, and just need a script written for your classroom, then again, I (and others here, I'm sure) will be glad to offer you a quote for the work.

      Aaron B.
      My Woefully Neglected Blog, where I occasionally mention Perl.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://967666]
[karlgoethebier]: I'll take that right hand road...
[thezip]: Howdy y'all. Is it safe to just delete StrawberryPerl-> cpan->build directories?
[1nickt]: karlgoethebier Thank you!! How could I not have ever heard of this musician?
[choroba]: thezip should be ok.
[thezip]: It seemed so, choroba, but I don't want to confuse anyone (especially myself!)
[choroba]: thezip unless something like this happens to you.

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (10)
As of 2017-03-23 20:58 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (294 votes). Check out past polls.