Turkish.pm 908 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package Turkish;
  2. require Exporter;
  3. @ISA = (Exporter);
  4. @EXPORT = qw(uc lc);
  5. use vars qw($VERSION);
  6. $VERSION = '0.1';
  7. use strict;
  8. use warnings;
  9. use utf8;
  10. sub uc
  11. {
  12. binmode STDOUT, ':utf8';
  13. my $result;
  14. foreach my $char (split(//,$_[0]))
  15. {
  16. if ($char eq 'i')
  17. {
  18. $result = $result.'İ';
  19. }
  20. elsif ($char eq 'ı')
  21. {
  22. $result = $result.'I';
  23. }
  24. else
  25. {
  26. $result = $result.uc($char);
  27. }
  28. }
  29. return $result;
  30. }
  31. sub lc
  32. {
  33. binmode STDOUT, ':utf8';
  34. my $result;
  35. foreach my $char (split(//,$_[0]))
  36. {
  37. if ($char eq 'İ')
  38. {
  39. $result = $result.'i';
  40. }
  41. elsif ($char eq 'I')
  42. {
  43. $result = $result.'ı';
  44. }
  45. else
  46. {
  47. $result = $result.lc($char);
  48. }
  49. }
  50. return $result;
  51. }
  52. 1;
  53. __END__