1# uuencode in Perl.
2# Copyright (C) 1995 Free Software Foundation, Inc.
3# Fran�ois Pinard <pinard@iro.umontreal.ca>, 1995.
4
5# `perl uudecode.pl FILES' will decode all uuencoded files found in
6# all input FILES, stripping headers and other non uuencoded data.
7
8while (<>)
9{
10    if (/^begin [0-7][0-7][0-7] ([^\n ]+)$/)
11    {
12	open (OUTPUT, ">$1") || die "Cannot create $1\n";
13	binmode OUTPUT;
14	while (<>)
15	{
16	    last if /^end$/;
17	    $block = unpack ("u", $_);
18	    print OUTPUT $block;
19	}
20	close OUTPUT;
21    }
22}
23
24exit 0;
25