43 open(DICT, "+>dict-$$") or die "Can't create dict-$$: $!";
44 binmode DICT; # To make length expected one.
47 my $pos = look *DICT, "Ababa";
48 chomp($word = <DICT>);
49 print "not " if $pos < 0 || $word ne "Ababa";
52 if (ord('a') > ord('A') ) { # ASCII
54 $pos = look *DICT, "foo";
55 chomp($word = <DICT>);
57 print "not " if $pos != length($DICT); # will search to end of file
60 my $pos = look *DICT, "abash";
61 chomp($word = <DICT>);
62 print "not " if $pos < 0 || $word ne "abash";
66 else { # EBCDIC systems e.g. os390
68 $pos = look *DICT, "FOO";
69 chomp($word = <DICT>);
71 print "not " if $pos != length($DICT); # will search to end of file
74 my $pos = look *DICT, "Abba";
75 chomp($word = <DICT>);
76 print "not " if $pos < 0 || $word ne "Abba";
80 $pos = look *DICT, "aarhus", 1, 1;
81 chomp($word = <DICT>);
83 print "not " if $pos < 0 || $word ne "Aarhus";
86 close DICT or die "cannot close";