package Encode::ROT13; use strict; use warnings; use parent qw( Encode::Encoding ); sub encode($$;$){ my( $obj, $str, $chk ) = @_; $str =~ tr/A-Za-z/N-ZA-Mn-za-m/; $_[1] = '' if $chk; # $_[1] is aliased through the call. Inplace edit. # (Remove whole string unless there's an error.) return $str; } no warnings 'once'; *decode = \&encode; # Because rot13( rot13() ) is a round-trip. __PACKAGE__->Define( 'rot13' ); 1; package main; use strict; use warnings; binmode \*DATA, ':encoding(rot13)'; chomp( my @words = ); print "$_\n" for @words; __DATA__ Apple cat dog strawberry watermelon #### Nccyr png qbt fgenjoreel jngrezryba