PERL   22

dict search

Guest on 30th April 2022 11:47:11 PM

  1. #!/usr/bin/perl -w
  2. my($name, $junk);
  3.  
  4. open(PW, "</usr/share/dict/words") || die "No open da file";
  5.  
  6. while ($line = <PW>)
  7. {
  8.         $found{$name} = 1;
  9. }
  10.  
  11.  
  12. while ($in = <STDIN>)
  13. {
  14.         if (defined($found{$in})) {
  15.                 print "yes\n";
  16.         }
  17.         else
  18.         {
  19.                 print "no\n";
  20.         }
  21. }
  22.  
  23. for $name (sort keys %found)
  24. {
  25.         print "Word $name\n";
  26. }

Raw Paste


Login or Register to edit or fork this paste. It's free.