Uuencode as a perl one-liner

perl -ple  'BEGIN{use File::Basename;$/=undef;$sn=basename($ARGV[0]);} $_= "begin 600 $sn\n".(pack 'u', $_)."`\nend" if $_' /some/file/to_encode.gz


perl -ple  'BEGIN{$/=undef;$s=`basename "$ARGV[0]"`;chop $s;} $_="begin 600 $s\n".(pack 'u', $_)."`\nend" if $_' /some/file/to_encode.gz

Alternatively you can just download this shell scripts which contains the perl one-liner: uuencode

This is very useful if you want to copy/paste small binary files between servers via a terminal session. You copy the encoded ascii into a text editor and save it (as e.g encoded.uu). Now run
uudecode encoded.uu
and you get you binary file back. It's in the current working directory. uudecode/encode are part of the sharutils package in most linux distributions. The perl one-liner is useful on a remote server where you don't have rights to install sharutils and you want to copy/paste a binary file to your local machine or another server where uudecode is available.