473,387 Members | 1,624 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Help with perl data structures and in-built functions.

4
I have never used perl before, and I was recommended to use this to write a script for this:

I have a file that has 2 columns like this:
A B
10 33
8 20
30 90

If B falls in a certain range, say 15 < B < 30, I need to store the corresponding value of A, 8 in this case, in some structure (hashtable?)

I have another file that looks like this
C D
34 X
40 Z
8 Y

If the value in C matches the one in our structure, I need to store the corresponding value of D someplace (an array?). In this case, since 8 is present in our structure, I store the value Y.

Am I on the right track or is there a smarter way to do this in perl?

Thanks!
Jul 9 '08 #1
6 1076
numberwhun
3,509 Expert Mod 2GB
This sounds like a homework question and since this is a learning forum, our policy strictly prohibits the posting of homework for answers.

So, that said, why not post the code that you have tried and we will help you get it working.

Regards,

Jeff
Jul 9 '08 #2
looza
4
1. Its not a homework question
2. I DO NOT need the code, I just need to know if Perl has any other structures/functions I can use to make it more efficient, and I needed to know that BEFORE I started writing the code.

Anyway, I will just use whatever my limited knowledge of Perl allows and post if I have any problems.
Jul 10 '08 #3
KevinADC
4,059 Expert 2GB
Keep in mind that the keys of a hash are unique, there can be no two keys that are the same. From what you have described perl can easily handle this task, how you do it though depends on what the purpose of the program will be. But I believe you are thinking along the correct lines. It will help though if you do get some code started, from there we can help you better.
Jul 10 '08 #4
looza
4
Keep in mind that the keys of a hash are unique, there can be no two keys that are the same. From what you have described perl can easily handle this task, how you do it though depends on what the purpose of the program will be. But I believe you are thinking along the correct lines. It will help though if you do get some code started, from there we can help you better.
Thanks for your help Kevin!
Jul 10 '08 #5
numberwhun
3,509 Expert Mod 2GB
1. Its not a homework question
2. I DO NOT need the code, I just need to know if Perl has any other structures/functions I can use to make it more efficient, and I needed to know that BEFORE I started writing the code.

Anyway, I will just use whatever my limited knowledge of Perl allows and post if I have any problems.
Please know that I was stating the policy because I have to. If you read your question, it sounds like it could be homework. There were no accusations, just hints at possibilities. If it is not homework, that's fine, just say so.

I agree with Kevin that your thinking was along the correct lines though. :)

Regards,

Jeff
Jul 10 '08 #6
KevinADC
4,059 Expert 2GB
For what its worth, I was pretty sure it was school/class/course work too.
Jul 10 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Sridhar R | last post by:
Hi, I have written in network project in python. the client sends a dictionary by pickling it over the socket and the server unpickles it. I also need a webclient for this. So I am wondering...
0
by: mrwoopey | last post by:
Hi, I am using the OLAP data cube in a web browser (using the code from the SQL 2000 toolkit). The OLAP services is on database server and the web interface is on the web server. If we do simple...
2
by: JS | last post by:
Does anyone know a good and thorough book about Data Structures with examples writtin in C? Especially Lists (Linked-List, Double Linked-List, Circular Linked-List), Stack, queue, trees etc. ...
1
by: kroty | last post by:
Hi, I want to learn about data structures in C. I know nothing about the subject. I just have read k&r and I feel confortable coding in C. :) Could you recommend me some book? Thanks!
2
by: shahoo | last post by:
Can anyone give me any link , information about Threaded Trees in C++? Any ource code , etc is apreciated.
4
by: Dave | last post by:
Hi. I am learning PyOpenGL and I am working with a largish fixed scene composed of several thousand GLtriangles. I plan to store the coords and normals in a NumPy array. Is this the fastest...
1
by: sandeep | last post by:
I am 1+ year experience so what bet links for C,C++ and data structures in C links for interviews
1
by: kiny3k | last post by:
i want to show the selected data of data grid in text boxes in asp.net (vb code), can anyone provide me coding for selectedindexchange event of data grid??
1
by: saikiranbiet | last post by:
hi iam a beginner in data structures but i got thorough concepts in c. can some one tell me few good FAQ's & good ebooks for this please
2
by: Joe Williams | last post by:
I'm writing a web application in plain ASP with VBScript, and I frequently want to display the contents of a data structure that I've created, for debugging purposes. In Perl, I can include a...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.