To make sure that the lines with "NA" are not used simply change:
to this
As to the second problem, I am not sure I understand...
Quote:
Secondly I would like to attach the following on to the end of the program so that the number of each mutation is recorded
You say "attach" this code to the end of what we have already written. How are you "attaching" it?
Are you copying and pasting?
If so, are you removing the perl "shabang" at the top?
Are you simply calling this script from inside the other script at the end?
Can you verify that the file you are opening has the expected data?
Are you getting error, or no results at all?
---------- Post updated at 09:36 PM ---------- Previous update was at 08:54 PM ----------
After looking at the code you want to attach, I see some problems...
You should always have the following at the top of your code:
This way you will get warnings and errors if the code is flawed.
I see that you do not properly initialize your variables, and these lines above would have immediately shown you that as well.
You will want something like this:
Then there are 2 lines above that I am not sure what you are trying to do with them...
First naming the variable the same as the array (@dna vs $dna) is not a god idea.
Keep in mind that to access the "@data" array you write "$data[x]" (where x = index number of item).
Example:
At the very least it is confusing. Then, you proceed to join the array to the string as one long string and remove spaces so you end up with:
and finally, you never actually USE "$dna", you only call "@dna" later.
Beyond that the code looks good, the foreach with the if/elsif/else block looks good.
Last edited by ddreggors; 06-11-2012 at 10:41 PM..
Hello all
im facing some kind of problem i have this string :
functionA() $" "$ functionB("arg1") $" = "$
i will like to replace all the pairs of opening and closing "$" to be something like that
functionA() <#" "#> functionB("arg1") <#" = "#>
i cant of course do is with simple ... (1 Reply)
Hi.
I have three arrays.
@a=('AB','CD','EF');
@b=('AB,'DG',HK');
@c=('DD','TT','MM');
I want to compare the elements of the first two array and if they match then so some substition.
I tried using the if statement using the scalar value of the array but its not giving me any output.
... (7 Replies)
Hi all,
I am trying to compare two arrays in perl using the following code.
foreach $item (@arrayA){
push(@arrayC, $item) unless grep(/$item/, @arrayB); ... (1 Reply)
I have a main file with variable tokens like this:
name: File1
===========
Destination/Company=@deploy.company@
Destination/Environment=@deploy.env@
Destination/Location=@deploy.location@
Destination/Domain=@deploy.location@
MIG_GatewayAddresses=@deploy.gwaddress@
MIG_URL=@deploy.mig_url@... (1 Reply)
Hi there, i have been trying different methods and i wonder if somebody could explain to me how i would perform a comparison on two arrays for example
my @array1 = ("gary" ,"peter", "paul");
my @array2 = ("gary" ,"peter", "joe");
I have two arrays above, and i want to something like this... (5 Replies)
Hi,
I'm new to perl and i have to write a perl script that will compare to log/txt files and display the differences. Unfortunately I'm not allowed to use any complied binaries or applications like diff or comm.
So far i've across a code like this:
use strict;
use warnings;
my $list1;... (2 Replies)
What do i need to do have the below perl program load 205 million record files into the hash. It currently works on smaller files, but not working on huge files. Any idea what i need to do to modify to make it work with huge files:
#!/usr/bin/perl
$ot1=$ARGV;
$ot2=$ARGV;
open(mfileot1,... (12 Replies)
I have these two file that I am trying to compare using shell arrays. I need to find out the changed or the missing
enteries from File2. For example. The line "f nsd1" in file2 is different from file1 and the line "g nsd6" is missing
from file2.
I dont want to use "for loop" because my files... (2 Replies)
Hi everyone
I have a question for you, as I am trying to learn more about Perl and work with some weather data. I have an ascii file (shown below) that has 10 lines with different columns. What I would like is have Perl find an "anomalous" value by comparing a field with the values from the last... (2 Replies)