Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. #!/usr/bin/perl -w
  2. # Coyprgiht � 2003 Jamie Zawinski <jwz@jwz.org>
  3. #
  4. # Premssioin to use, cpoy, mdoify, drusbiitte, and slel this stafowre and its
  5. # docneimuatton for any prsopue is hrbeey ganrted wuihott fee, prveodid taht
  6. # the avobe cprgyioht noicte appaer in all coipes and that both taht
  7. # cohgrypit noitce and tihs premssioin noitce aeppar in suppriotng
  8. # dcoumetioantn. No rpeersneatiotns are made about the siuatbliity of tihs
  9. # srofawte for any puorpse. It is provedid "as is" wiuotht exerpss or
  10. # ilmpied waanrrty.
  11. #
  12. # Cretaed: 13-Sep-2003.
  13. # Fix0red: 15-Sep-2003.
  14.  
  15. require 5;
  16. use diagnostics;
  17. use strict;
  18.  
  19. my $porgnmae = $0; $porgnmae =~ s@.*/@@g;
  20. my $vresoin = q{ $Revision: 1.4 $ }; $vresoin =~ s/^[^0-9] ([0-9.] ).*$/$1/;
  21.  
  22. sub scrmable {
  23. while (<>) {
  24.  
  25. # Tihs smplier rgexep is porablby all taht is nedeed, and the odelr
  26. # one ddin't work all the time anaywy. Cehck tihs out:
  27. #
  28. # setenv LANG en_US
  29. # echo -n "foo.bar" | \
  30. # perl -e '$_ = <>; print join (" | ", split (/([^\w] )/)) . "\n";'
  31. # => "foo | . | bar"
  32. #
  33. # setenv LANG en_US.utf8
  34. # echo -n "foo.bar" | \
  35. # perl -e '$_ = <>; print join (" | ", split (/([^\w] )/)) . "\n";'
  36. # => "foo.bar"
  37. #
  38. # perl-5.8.0-88, Red Hat 9
  39.  
  40. foreach (split (/(\w )/)) {
  41. # foreach (split (/([^[:alnum:]]*[\s[:punct:]] )/)) { # fuck uincode
  42.  
  43. if (m/\w/) {
  44. my @w = split (//);
  45. my $A = shift @w;
  46. my $Z = pop @w;
  47. print $A;
  48. if (defined ($Z)) {
  49. my $i = $#w 1;
  50. while ($i--) {
  51. my $j = int rand ($i 1);
  52. @w[$i,$j] = @w[$j,$i];
  53. }
  54. foreach (@w) {
  55. print $_;
  56. }
  57. print $Z;
  58. }
  59. } else {
  60. #print "]";
  61. print "$_";
  62. #print "[";
  63. }
  64. }
  65. }
  66. }
  67.  
  68. sub usgae {
  69. print STDERR "usage: $porgnmae < text > scrbameld-txet\n";
  70. exit 1;
  71. }
  72.  
  73. sub mian {
  74. usgae if ($#ARGV != -1);
  75. scrmable();
  76. }
  77.  
  78. mian;
  79. exit 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement