I was trying to do this using just basic arrays which I am more familiar with but it seems to be more complicated to try to do it that way. I haven't tried using hashes yet, I'm pretty new to perl, I only use it every now and then to do some things with data that excel and my stats program...
I'm trying to get started on some basic processing of data in array form. Basically this is a segment of what the data file looks like:
20070314180137 1003 1 641 1
20070314180137 1003 3 598 9
20070314180137 1003 4...
What I want to do is compare two arrays, one is just a vector with a single column, the other is multidimensional. I want to look at the 3 column in the multidimensional array and compare it to the single column in the other array and remove all of the lines from the multidimensional array for...
I have this line of code:
$prelimResult = mysql_query("SELECT MAX(volume),MAX(issue),MAX(year) FROM articles",$db);
That doesn't work quite how I want it to. I want it to find the largest volume, then the largest issue within that volume but instead this finds the largest volume...
mikevh, Sure that works for printing but that's not what I want to do with it. I'm going to be doing some more complicated things for which I need everything to be in one array where I can access specific elements.
What Siberian suggested is too simple to work, but if I went along those...
That would work if I just wanted to print it out, but I want to be able to work with the individual elements later on. With that example it puts everything from a line into one element resulting in a single dimensional array, but I need to refer to specific elements like the "A" in...
I contacted EPrime about my problem and this is all they would tell me. I don't understand it, but perhaps it would be helpful:
"The most common methods to call and access external rograms would be via OLE/COM Automation or via DLL calls via Declare statements. The use of these methods...
I'm actually using E-Basic (with the E-Prime software) but I'm told most VB commands will work.
I'm using the E-Prime software to run an experiment, the software does not explicitely support playing a video stimuli but the E-prime support tells me that I can put in code like this...
I have Learning Perl (and I read the entire thing) it doesn't even cover multidim arrays. I just got the Programming Perl book yesterday and am working on going through it.
I read somewhere in the perldoc that @array[1]->[2] and @array[1][2] mean exactly the same thing, is this not the case...
I can't figure out what is wrong with my code. It's supposed to create an array and print it out, but nothing prints, I don't get any error messages or anything.
Here is my code:
while (<>) {
chomp;
push @isr, [split/\t/];
}
for my $i(0..$#isr){
if ($isr[$i][5] eq...
I'm not understanding how to create a multidimensional array by reading lines from a file.
So say I have a file like this:
0 1 2 3
4 5 6 7
8 9 10 11
With lines of numbers separated by tabs.
I would have something like this to read the lines from the...
I'm not sure on what platform the input files were generated, we received them from a colleague. I have no idea how to look at everything in hex. However, if that is the problem, that it only removes the 0D0A then how do I chomp it so that it removes the entire x0D0D0A? Alternatively, how can...
I already mentioned this. I do see the M^'s in Unix when using Pico. I also see the M^'s in emacs. Transferring in ASCII to windows doesn't help as the M^'s are already there in Unix.
No, Unix is doing the M^'s, Windows is doing rectangle boxes. If Unix was interpreting it as a \n then it should be going to a new line rather than printing the M^
I"m running the program in Unix. Then after it generates the output.txt file I open it with Pico and I see the M^'s. In windows after I transfer it, it interprets those in Excel as going to a new line. Transferring in ASCII makes no difference since the M^s are also there in Unix.
Yes I am using chomp. And if that was the problem, it wouldn't make sense that the M^s would appear for one of the columns when I print it out in one order and go away when I print them out in another order. Here is the full text of my code:
#!/usr/bin/perl -w
use strict;
use warnings;
use...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.