Use and complete the template provided. If you don't, your post may be deleted!
- 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
- Relevant commands, code, scripts, algorithms:
This is what I have so far...
#!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";
-
The attempts at a solution (include all code and scripts):
see above. -
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
Thanks!