CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner: Re: [pjshort42] Issues with grep: Edit Log


Jul 22, 2012, 4:43 PM

Views: 1959
Re: [pjshort42] Issues with grep

you need to put " my " in front of variables so they don't alter or get altered some where outside of its scope. Also useing the modules

 use strict;  #useing this will help  
use warnings; # As will this help
my @array = qw();

So your openning the file and comparing the info in the file with whats in the array nodeA and nodeB and they have to match in the same place in each?


my @file =  <FILE>; 
my @nodeA = qw(dog cat perl pig);
my @nodeB = qw(blah dog perl find);

the perl is in the same place in both arrays. But from looking over the code its in compleate. Whats in the arrays nodeA and nodeB?

(also on anouther note these changes are for perl v5.10 and newer:)

open my $file,"<", "seqmonktop550.txt" or die $!; #changed for a 3 arg open 
my @nfkbgenes = <$file>;
my @nfkb_nodeA = ();
my @nfkb_nodeB = ();
my @nfkb_contacts = ();
my $sizenodeA = scalar @nodeA; #makes the intent more clear
for my $i (0..$sizenodeA){ #changed out the 3 arg for. This is more simple.
if ((exists $nfkbhash{$nodeA[$i]}) or (exists $nfkbhash{$nodeB[$i]})){ #it printed matching results with or but and it prints nothing
push(@nfkb_nodeA, $nodeA[$i]);
push(@nfkb_nodeB, $nodeB[$i]);
push(@nfkb_contacts, $contacts[$i]);

(This post was edited by wickedxter on Jul 22, 2012, 4:44 PM)

Edit Log:
Post edited by wickedxter (User) on Jul 22, 2012, 4:44 PM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives