if ($ship =~ m/^\d+/) {
$need{Fine} = $ship;
} else {
- $ship =~ y/_/ /;
- open F, "/home/ian/private/puzzle-pirates" or die $!;
- my $this_ship= 0;
- my $the_ship;
- while (<F>) {
- if (!m/\S/ || m/^\s*\#/) {
- $this_ship= 0;
- next;
- }
- if (!m/^\@/) {
- next;
- }
- if (m/^\@(( [A-Z][-a-z]+){2,})\s*$/) {
- $this_ship= (uc $1 eq uc " $ship" or
- uc $+ eq uc " $ship");
- $the_ship= $1;
- next;
- }
- next unless $this_ship;
- if (m/^\@\s+(\d+)\s+fine\s*/) {
- $need{Fine} = $1;
- last;
- }
- }
- die $! if F->error;
- die "unknown ship $ship" unless defined $need{Fine};
- if (defined $ship) {
- pr1("vessel",$the_ship);
- }
}
pr1('desired stock level', sprintf("%4d fine rum", $need{Fine}));