psychoto has asked for the wisdom of the Perl Monks concerning the following question:
HELP????print "Author to search for:"; chomp($search = <STDIN>); open (INPUT, "books.txt"); while (<INPUT>){ chomp $_; ($title, $author, $genre, $price) = split /:/,$_; if ($search == $author) { $totalprice += $price; @info = ($title, $genre, $price); $found++; } } print "$found books by $author were found...\n"; print "They are:\n"; print "\tBook Title\t\t\tGenre\tPrice"; print @info; print "\tTotal price of these books by $seach is $totalprice"; close INPUT;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Searching input file
by rbc (Curate) on Feb 27, 2002 at 23:29 UTC | |
|
Re: Searching input file
by jlongino (Parson) on Feb 28, 2002 at 04:15 UTC | |
by psychoto (Novice) on Feb 28, 2002 at 06:35 UTC | |
|
Re: Searching input file
by tfrayner (Curate) on Feb 28, 2002 at 00:43 UTC | |
|
Re: Searching input file
by strat (Canon) on Feb 28, 2002 at 00:35 UTC | |
by jlongino (Parson) on Feb 28, 2002 at 04:38 UTC | |
|
Re: Searching input file
by Anonymous Monk on Feb 28, 2002 at 09:27 UTC | |
by h.toothrot (Initiate) on Feb 28, 2002 at 12:35 UTC |