PERL 11
Mk-key.pl Guest on 3rd October 2020 12:14:33 AM
  1. #!/usr/bin/perl -w
  2.  
  3. sub mkkeys {
  4.     my(@ret);
  5.     foreach $k (split(/[, ]+/,$_[0])) {
  6.         push(@ret, &mkkey_args($k));
  7.     }
  8.     @ret;
  9. }
  10. # this should be used when the keys come from the XSL-processed
  11. # keys
  12. sub mkkey_fast {
  13.     substr($_[0], 0, 6);
  14. }
  15.  
  16. # this should be used when the keys come from user-specified
  17. # arguments
  18. sub mkkey_args {
  19.     my($tmp) = "\L$_[0]";
  20.     $tmp =~ tr/\`\'\"()[]:;.-//d;
  21.     $tmp =~ s/^\s*//; $tmp =~ s/\s*$//;
  22.     &mkkey_fast($tmp);
  23. }
  24.  
  25. 1;

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

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