1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#need help on getting this program to be able to open files after the search #item was printed in the program. a hash is formatted: xxx xxx xxx
#the program reads the second line and prints the entire the line on screen.
#!/usr
open(PH, "customers.txt") or die "cannot open customers.txt: $!\n";
while(<PH>) {
chomp;
($number, $order)= ( split(/\s+/, $_) )[1,2];
$phone{$number} = $_;
$order{$order} = $_;
}
close(PH);
print "[(c)mezainc.geo]Customer log files... Type 'q' to quit\n";
while (1) {
print "Reference number/name: ";
$number = <STDIN>; chomp($number);
$order = "";
if (! $number ) {
print "order? ";
$order = <STDIN>; chomp($order);
}
next if (! $number and ! $order);
last if ($number eq 'q' or $order eq 'q');
print "Customer: $phone{$order}\n";
}
if ($order and exists $Order{$order} ) {
print "Customer: $Order{order}\n";
print "Customer record not found.\n";
}
print "\nAll done. \n";
|