home *** CD-ROM | disk | FTP | other *** search
- From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall)
- Newsgroups: comp.lang.perl,alt.sources
- Subject: Re: uumerge.pl
- Message-ID: <8662@jpl-devvax.JPL.NASA.GOV>
- Date: 10 Jul 90 02:09:26 GMT
-
- In article <3317@tuminfo1.lan.informatik.tu-muenchen.dbp.de> rommel@lan.informatik.tu-muenchen.dbp.de (Kai-Uwe Rommel) writes:
- : And this is my version for awk. It does not require all parts to be in
- : separate files, the parts may be concatenated to one single file.
-
- [Pretty little awk script deleted.]
-
- A few little problems with the awk script: 1) I don't have nawk, and 2) it
- won't handle a "-- " right after an "M" line correctly.
-
- Also, our uudecode doesn't know what to do with file "-".
-
- Here's my little contest entry. It'll also handle multiple uudecodes from
- a single file, as well as single uudecodes over multiple files.
-
- #!/usr/bin/perl
-
- while (<>) {
- if ($seq = /^begin/ .. /^end/) {
- $in = open(UU, "| uudecode"), next if $seq == 1;
- $in = 1 if /^M/ && length($_) / 10 == 6;
- $in = 0 if /^(--)?\s*$/ || /[a-z]/;
- $in = 1 if /^end/;
- }
- }
- continue {
- print UU if $seq && $in;
- }
-
-
- Or perhaps something more like this:
-
- #!/usr/bin/perl
- while (<>) {
- $inrange = /^begin/ .. /^end/;
- $valid = 1 if /^M/ && length($_) / 10 == 6;
- $valid = 0 if /^(--)?\s*$/ || /[a-z]/;
- $valid = open(UU, "| uudecode") if $inrange == 1;
- $valid = 1 if /^end/;
- print UU if $inrange && $valid;
- }
-
- "There's more than one way to do it."
-
- Larry Wall
- lwall@jpl-devvax.jpl.nasa.gov
-