The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers > Homework & Coursework Questions
.
google unix.com



Homework & Coursework Questions Students must use and complete the template provided. If you don't, your post may be deleted! Special homework rules apply here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How Can a Machine Reads a Compiler Since A Compiler is Written in Text! Not Binaries? f.ben.isaac High Level Programming 12 11-14-2008 11:25 AM
g++ compiler issue vasanthan Red Hat 1 05-09-2008 03:08 AM
GCC compiler issue on redhat4.5 nano2 Linux 0 01-16-2008 06:00 AM
CC 5.5 compiler flag to issue 64bit porting warnings on sparc-solaris shobhah SUN Solaris 0 03-02-2007 02:47 AM
cc compiler issue fishman2001 High Level Programming 2 04-29-2002 02:46 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 1 Week Ago
Dalcron Dalcron is offline
Registered User
  
 

Join Date: Oct 2009
Posts: 7
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 (permalink)  
Old 1 Week Ago
pludi's Avatar
pludi pludi is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2008
Location: .at
Posts: 1,833
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.
Sponsored Links
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:36 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0