View Single Post
Old 04-11-2005, 04:23 AM   #12 (permalink)
Rocket
Registered User
 
Join Date: Apr 2005
Posts: 13
Rocket is on a distinguished road
No, i mean it is onll taking one name from the file.
it is in following format:

pete,50,20
mary,34,23
dave,98,34
sue,23,34

there are only four names, and it only seems to tally the last name and numbers on the list.
I kept playing and plaiying, gpt most of the other stuff sorted, very messy indeed.
but no matter what i did, i couldnt work out how to make it tally all names in the file, here is my script so far, and thanx for the help,


Code:

open NAME, 'namedate.txt' || die "cannot open namedate.txt: $!\n";
open NAME2, '>nam2.txt' || die "cannot open nam2.txt: $!\n";
chomp;
while(<NAME>) {
   @num=($name, $wage, $hours) = split(/\,/);
   $total=($wage * $hours);
}

if  ($total>1000) {
 $taxed=($total/2)
}

elsif ($total<1000){
	$taxed=($total*.38)
}

$tax=($total-$taxed);

print NAME2 "NAME= $name\n\nWAGE=\$ $wage\tHOURS= $hours\n NET=\$$total\tGROSS=\$$taxed\ttax payed=\$$tax";
close NAME;
close NAME2;

the @num array was originally a my statement, but i was to lame to even get that going, hehe

thanx again
Rocket is offline   Reply With Quote