At 11:01 PM -0600 1/12/12, Chris Stinemetz wrote:
>
Define an array with the headers you expect:
my @headers = ( '>csno', 'rfpi', 'vrp0', ... );
Use that array for your keys instead of the @header array.
To avoid warnings of uninitialized values for missing values, print the
expression
>
> Define an array with the headers you expect:
>
> my @headers = ( '>csno', 'rfpi', 'vrp0', ... );
>
> Use that array for your keys instead of the @header array.
>
> To avoid warnings of uninitialized values for missing values, print the
> expression (defined $data{$key} ? $data{$key} : '' ) inst
On 1/12/12 Thu Jan 12, 2012 2:03 PM, "Chris Stinemetz"
scribbled:
> Any advice on how to maintain the order of elements in the @header
> array and print the value to the right of the "=" sign for each
> dataset, and if there is a value in the dataset that doesn't match the
> element in the @hea
Thank you Jim. That got me over that hurdel!
Any advice on how to maintain the order of elements in the @header
array and print the value to the right of the "=" sign for each
dataset, and if there is a value in the dataset that doesn't match the
element in the @header simply leave the value blank
On 1/12/12 Thu Jan 12, 2012 1:07 PM, "Chris Stinemetz"
scribbled:
> Thanks for your advice Jim.
>
> Although it makes very good sense to me, I am having a little
> difficult implementing it. I will have to admit referencing is still a
> bit foreign to me.
>
> I am getting the following error
Thanks for your advice Jim.
Although it makes very good sense to me, I am having a little
difficult implementing it. I will have to admit referencing is still a
bit foreign to me.
I am getting the following error and I am not sure how to fix it.
Type of arg 1 to push must be array (not reference
Just from the subject, for comparing arrays, I have been using
Array::Diff which works always fine for me.
I have a script where I have captured the value on the left side of
the "=" as the header for my table. Now I want to take the value on
the right side of the "=" sig
At 4:13 AM -0600 1/11/12, Chris Stinemetz wrote:
I have a script where I have captured the value on the left side of
the "=" as the header for my table. Now I want to take the value on
the right side of the "=" sign and populate a new row in table format
where the header value I stored in the @he
"Chris Stinemetz" wrote in message
news:ca+hbpzhw7scz2dnabxd0j1bqfcj3vpo7xm_dvrbqmpwrnul...@mail.gmail.com...
I have a script where I have captured the value on the left side of
the "=" as the header for my table. Now I want to take the value on
the right side of the "=" sign and populate a
I have a script where I have captured the value on the left side of
the "=" as the header for my table. Now I want to take the value on
the right side of the "=" sign and populate a new row in table format
where the header value I stored in the @header array matches the value
on the left side of th
> Hi guys (and gals!),
>
> I want to compare a constant, known (expected values) array with the
> results I'm collecting in another array.
>
> Something like this, but I don't think this works the way I want it to:
>
> my @rray1 = qw( One Two Three );
> chomp( my @rray2 = );
>
> print "The 2 a
Hi guys (and gals!),
I want to compare a constant, known (expected values) array with the
results I'm collecting in another array.
Something like this, but I don't think this works the way I want it to:
my @rray1 = qw( One Two Three );
chomp( my @rray2 = );
print "The 2 arrays are the same\n"
Jeff Westman wrote:
> If I read 2 files into separate arrays, I *should* be able to compare
> the arrays, and therefore see if the files are the same or not. SO
> why doesn't this work?
>
> #--- begin code
> #!/usr/local/bin/perl -w
>
> $f1 = "eghpoli1";
> $f2 = "eghpoli2";
>
> open(F1, "$f1") o
> if (@Af1 eq @Af2) { print "Files compare okay\n"; }
> else { print "Files differ\n"; }
> #
How about something clunky like this:
if (join("",@Af1) eq join("",@Af2)) { print "Files compare okay\n"; }
else { print "Files differ\n"; }
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For add
On Mon, 10 Feb 2003 13:55:46 -0800 (PST), Jeff Westman <[EMAIL PROTECTED]> wrote:
> If I read 2 files into separate arrays, I *should* be able to compare the
> arrays, and therefore see if the files are the same or not. SO why doesn't
> this work?
If I read 2 files into separate arrays, I *should* be able to compare the
arrays, and therefore see if the files are the same or not. SO why doesn't
this work?
#--- begin code
#!/usr/local/bin/perl -w
$f1 = "eghpoli1";
$f2 = "eghpoli2";
open(F1, "$f1") or die "cannot open $f1: $!\n";
open(F2, "
Hello
Thanks for your help
--
___
Diego Mauricio Riano Pachon
Biologist
Institute of Biology and Biochemistry
Potsdam University
Karl-Liebknecht-Str. 24-25
Haus 20
14476 Golm
Germany
Tel:0331/977-2809
http://bioinf.ibun.unal.edu.co/~gotem
http://www.geocities.c
perldoc -f grep
Essentially you would need to open each file, read each line and grab the name somehow
(regex, split, etc.). Then store the name to an array for the file (consider hash of
arrays with key being the filename and the value the array of names for that file).
Then store the name to
Hello folks
I want to ask for your help about the following thing:
I have several files, like this one:
Katrin 12334 lsksol 094059
Karen 29383 skdjsk 092831
Paul21928 lskdiw 029384
I want to compare all the files to know which names are in all of them.
could you give some hints
> -Original Message-
> From: Merritt Krakowitzer [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 24, 2002 4:19 AM
> To: Bob Showalter; 'Timothy Johnson'; 'Beginners '
> Subject: RE: Comparing Arrays
>
> > I just found out I can shorten my on
om what i can tell, it
*should*
be giving an error about being unable to coerce an array to a hash, but it
seems to
work fine, it's driving me nuts :)
Merritt
>
> But mine has a similar defect:
>
>qw(foo foo bar) is considered equal to qw(foo bar bar)
>
> Rats! Tha
> -Original Message-
> From: Timothy Johnson [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 23, 2002 11:41 AM
> To: 'Bob Showalter '; ''Merritt Krakowitzer' '; 'Beginners '
> Subject: RE: Comparing Arrays
>
>
>
>
LOL yup. I knew someone would catch that. As Marvin would say, "Back to the
old drawing board."
-Original Message-
From: Jeff 'japhy' Pinyan
To: Timothy Johnson
Cc: 'Bob Showalter '; ''Merritt Krakowitzer' '; 'Beginners '
Se
On Jul 23, Timothy Johnson said:
>In the "quick and dirty" category, you can do something like this:
Too dirty. It says ('a', 'a', 'b') and ('a', 'b', 'b') are the same.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmo
a key with each
#element of the second array
}
return 1;
#if we make it this far, they're equal
}
#
-Original Message-
From: Bob Showalter
To: 'Merritt Krakowitzer'; Beginners
Sent: 7/23/02 5:49 AM
Subject: RE: Comparing A
> -Original Message-
> From: Merritt Krakowitzer [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 23, 2002 3:48 AM
> To: Beginners
> Subject: Comparing Arrays
>
>
> Hi
>
> I would like to know how to compare 2 arrays.
>
> I have 2 arrays and I would
Merritt Krakowitzer wrote at Tue, 23 Jul 2002 09:48:13 +0200:
> I would like to know how to compare 2 arrays.
>
> I have 2 arrays and I would like to compare the contents of the data. It doesn't
>matter in which
> order the data is stored so long as its the same. So comparing the bellow should
Merritt Krakowitzer wrote:
>
> Hi
Hello,
> I would like to know how to compare 2 arrays.
perldoc -q array
Found in /usr/lib/perl5/5.6.0/pod/perlfaq4.pod
[snip]
How do I compute the difference of two arrays?
How do I compute the intersection of two arrays?
[snip]
How do
<[EMAIL PROTECTED]> wrote:
> Hi
>
> I would like to know how to compare 2 arrays.
>
> I have 2 arrays and I would like to compare the contents of the data.
> It doesn't matter in which order the data is stored so long as its the same.
> So comparing the bellow should read true, but if they didn
@foo = qw(
foo bar cat dog
);
my @bar = qw(
dog cat foo bar
);
Hope that made some sense.
I managed to find a module for comparing arrays but I would prefer not to
do it that way.
TIA
Merritt
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
On Jul 19, Mooney Christophe-CMOONEY1 said:
>"That's an excellent question," i said to myself; "i'll bet there's a
>module for that!"
>
>So, i looked on cpan, and it looks like Array::Compare will do the
>trick.
All the same, this is a question that stumps a lot of people. There are
two ways to
"That's an excellent question," i said to myself; "i'll bet there's a module for that!"
So, i looked on cpan, and it looks like Array::Compare will do the trick.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
At 15:21 19.07.2001 +0200, Diego Riaño wrote:
>Hi everybody
>
>I have two array, like this
>
>@array1=(one, two, three);
>@array2=(one,tww,three);
>
>Is there some way to compare the two arrays?
>I was trying with the eq and ne operations inside an IF statement but i
>does not work
>
>Could someon
Hi everybody
I have two array, like this
@array1=(one, two, three);
@array2=(one,tww,three);
Is there some way to compare the two arrays?
I was trying with the eq and ne operations inside an IF statement but i
does not work
Could someone help me.
Thanks
Diego
--
To unsubscribe, e-mail: [
Here's a nice way to do what Stuart Watts recommended
(chomping the array):
open (FILE, "whatever");
chomp (my @array=);
And boom the newlines are killed in one fell swoop.
I've used this with fantastic results. Stuart's way
works well too, but I figured I'd throw this in...very
'perlish'.
~Mat
Excellent description Collin. I have just a couple of comments to add.
Collin Rogowski wrote:
>
> A hash is a data structure, which assigns a key to value.
> In Perl the key is given in the curly braces. A key/value
> pair is entered like this: $hash{$key} = $value (assuming
> the variables $ke
A hash is a data structure, which assigns a key to value.
In Perl the key is given in the curly braces. A key/value
pair is entered like this: $hash{$key} = $value (assuming
the variables $key and $value, hold the key and value
respectivly).
> open (EXIST, "/tmp/users");
> @exist = ;
>
All,
Monumentally basic question here (but hey, this is what this list is for,
yeah?).
I'm working on my first ever useful script (after "Hello World" and "Enter a
number" "Wrong!" type things). It's also my first ever foray into
programming of any kind, so please make sure answers are in layma
38 matches
Mail list logo