| | |
Perl DBF file doubt
Please support our Perl advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2009
Posts: 1
Reputation:
Solved Threads: 0
Hi all,
I am a perl newbie. I am using a perl code to read a column full of data from 1 field into an array
Now for example if my @data[1] consists of list of numbers, I need to find the diff between current record and prev record till it reaches the end of array.. Perl has such complex way of array accessing, I donno how to do $data[$i]-$data[$i-1].
I am a perl newbie. I am using a perl code to read a column full of data from 1 field into an array
Perl Syntax (Toggle Plain Text)
for(my $i=2;$i<table->last_record;$i++) my @data = $table->get_record($i,"Date");
Now for example if my @data[1] consists of list of numbers, I need to find the diff between current record and prev record till it reaches the end of array.. Perl has such complex way of array accessing, I donno how to do $data[$i]-$data[$i-1].
0
#2 Oct 26th, 2009
Have you actually tried doing exactly that?
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
•
•
Join Date: Oct 2009
Posts: 8
Reputation:
Solved Threads: 1
0
#3 Oct 26th, 2009
Perl Syntax (Toggle Plain Text)
my @data1=(1,6,3,4,5); for($i=1;$i<=$#a;$i++) { $b=$a[$i]-$a[$i-1]; print "Difference b/n current and previous records: $b\n"; }
0
#4 Oct 26th, 2009
Okay? So why are you using "$a[...]" when your array is @data1?
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
•
•
Join Date: Oct 2009
Posts: 8
Reputation:
Solved Threads: 1
0
#5 Oct 26th, 2009
sorry! actually i have assumed the '@a' in place of '@data1'.
Perl Syntax (Toggle Plain Text)
my @data1=(1,6,3,4,5); for($i=1;$i<=$#data1;$i++) { $b=$data1[$i]-$data1[$i-1]; print "Difference b/n current and previous records: $b\n"; }
0
#6 Oct 26th, 2009
Okay? So why are you attempting to do other's homework for them?
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
0
#8 Oct 26th, 2009
To help them learn. Definately not to do their homework for them.
Get them to attempt it, and post their code. Then, give them pointers on what they then need to do to fix that code, and get them to do it and post it again.
IOW, make them think. When you do it for them, they learn nothing.
Get them to attempt it, and post their code. Then, give them pointers on what they then need to do to fix that code, and get them to do it and post it again.
IOW, make them think. When you do it for them, they learn nothing.
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
•
•
Join Date: Oct 2009
Posts: 3
Reputation:
Solved Threads: 0
0
#10 Oct 27th, 2009
i am also dame new in pearl field. thanks for this informative topic. i like it very much. keep posting here for more information.
![]() |
Similar Threads
- How to create IDX file out of DBF file in java (Java)
- DBF file and C# DataGridView (C#)
- how to read dbf file using C# [whats wrong with my code] (C#)
- How To Make .dbf File Extarction User Friendly (Visual Basic 4 / 5 / 6)
- reading records from a .dbf file (Visual Basic 4 / 5 / 6)
Other Threads in the Perl Forum
- Previous Thread: How to parse this confusing file
- Next Thread: Perl: how to replace character '/' with '\'
Views: 1367 | Replies: 10
| Thread Tools | Search this Thread |
Tag cloud for access, array
2005 access account add append arc array arrays byte c# c++ cache char character class click code combo conficker connection control convert coordinates count counttheoccurenceofanintegerinthe10inputs data database datagrid datagridview dbconnection dropdown dropdownlist dynamic exception file files frequency function government graph histogram index input int integer ip java javascript list listbox login lookup loops malware math menu module multi multidimensional mysql net networking number output parse perl php physics pointer position problem random range read recursion reference reuse saving security service site split sql storage stream string strings table text transfer troubleshoot user users vb vb.net visualbasic.net web website windows winforms







