Compiler issue I think...

 
Thread Tools Search this Thread
Homework and Emergencies Homework & Coursework Questions Compiler issue I think...
# 1  
Old 11-08-2009
Compiler issue I think...

Use and complete the template provided. If you don't, your post may be deleted!

1. The problem statement, all variables and given/known data:
One problem says do the following problem using perl:
A stamp dealer maintains a price list that displays the country, the Scott catalog number, year of issue, description, and price:

Sample entry:
Kenya 288-92 1984 Heron Plover Thrush gonolek Apalis $6.60


2. Relevant commands, code, scripts, algorithms:
This is what I have so far...
Code:
#!usr/bin/perl
#reads the lines from a file and formats the output and calculates a total price.

Open (FILEIN, "data.txt") || die ("Cannot open file");
ttlprc= 0;
while($in = <FILEIN>)
{
  ($con, $catnum, $yr, $str) =split (/\s/,$in, 4);
  $rts=reverse($str);
  ($prc, $desc) =split (/\s/, $rts, 2);
  print "Country: $con\n";
  print "Catagory Number: $catnum";
  print "Year: $yr";
  print "Description: $desc";
  print "Price: $prc";
  $ttlprc= $ttlprc + $prc ;
}

print "The total price is \$$ttlprc";



3. The attempts at a solution (include all code and scripts):
see above.


4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
University Maryland University College, Adelphi Maryland, CMIS 325A

Note: Without school/professor/course information, you will be banned if you post here!

I don't really want someone to "solve" this, I just can't get my complier to work.... if you could try to compile this and maybe suggest one... that would be great. If you notice any obvious reason why I can't get this to run (it's grayed out when I attempt to run it) that would be great :P

Thanks!
# 2  
Old 11-08-2009
What do you mean by "get my compiler to work"? Perl scripts usually aren't compiled like C programs. Or do you get a syntax error? Because I can see 3 definite syntax errors in the code you provided (all in the first 3 code lines). That, plus your total price will be way off (hint: if you reverse something, you'll have to reverse it again to be right again), and your output won't look like you'll expect it to look.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shc compiler issue

I am using the shc shell compiler, it works fine, just that when i execute it, it displays the code at the terminal. Is there any way to hide this as well? otherwise it beats the purpose of hiding the code. Thanks ! (7 Replies)
Discussion started by: ysvsr1
7 Replies

2. UNIX for Dummies Questions & Answers

cc compiler and gcc compiler

hi, can we install gcc compiler in unix based OS(sun solar,IBM AIX,HP,etc) and also can we install sun cc compiler in AIX environment and vice versa. and more ..is linux support cc compiler regards Ajay (3 Replies)
Discussion started by: ajaysahoo
3 Replies

3. Programming

How Can a Machine Reads a Compiler Since A Compiler is Written in Text! Not Binaries?

To make a programming language you need a compiler, so what was the first programming language and how was is created if you need the compiler first? The compiler itself is considered as a high language comparing to the machine! since the compiler is not created in 1's and 0's... Eventhough i... (12 Replies)
Discussion started by: f.ben.isaac
12 Replies

4. Red Hat

g++ compiler issue

Hi i need to install g++ compiler in RHEL 5.1 and i downloaded the compiler from the below mentioned site g++ - Free Software Directory - Free Software Foundation its in format gcc-g++-4.0.2.tar.bz2 and i have unziped it...... can any one tell me the procedure to install it ..it dont... (1 Reply)
Discussion started by: vasanthan
1 Replies

5. Linux

GCC compiler issue on redhat4.5

Hi all, I am using gcc4.1.1 on redhat4.5 and when i rethrow an exception and I am catching it .. The application aborts and throws the following error message to stdout - the error that's been thrown is been caught but never gets that far as it falls over on throw statement Has anyone ever... (0 Replies)
Discussion started by: nano2
0 Replies

6. Solaris

CC 5.5 compiler flag to issue 64bit porting warnings on sparc-solaris

Hi, We are porting our application from 32bit to 64bit. We tried -xarch=v9, -xarc=v9a and -xport64=full options so that compiler to issue 64bit porting warnings. But we are not getting any porting warninings WE are using CC 5.5 compiler on sparc-solaris m/c. Please tell us some powerful... (0 Replies)
Discussion started by: shobhah
0 Replies

7. UNIX for Dummies Questions & Answers

xl C/C++ compiler to GCC compiler

Hi, we are converting from IBM-AIX(xl c/c++ compiler) to Linux(GCC complier). As a part of this i need to change the CFLAGS. The xl c/c++ complier CFLAGS is CFLAGS := $(CDEBUG) $(PROJECT_INCLUDE_DIRS) $(COBJECT_MODE) -qcpluscmt -qmakedep -qcheck=all \ -qalign=bit_packed $(LINT_FLAGS)... (0 Replies)
Discussion started by: pbattu1
0 Replies

8. UNIX for Advanced & Expert Users

CC compiler

Hi, If you you have CC installed, then where does it defaultly lives. Thanks (3 Replies)
Discussion started by: vtran4270
3 Replies

9. Programming

cc compiler issue

Quick Question, may be very easy to answer. I've just got a Sparc 5 for my home with Solaris 2.6 pre installed onto it. When I go to use the Solaris Compiler 'cc' it comes back to me with the message '/usr/ucb/cc: language optional software package not installed'. Is this something that can be... (2 Replies)
Discussion started by: fishman2001
2 Replies
Login or Register to Ask a Question