home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!att-out!walter!porthos!donner!rdm2
- From: rdm2@donner.uucp (24337-mcburnett)
- Subject: Re: UUDECODE and perl ...
- Organization: Bellcore, Livingston, NJ
- Date: Wed, 11 Nov 92 21:17:03 GMT
- Message-ID: <1992Nov11.211703.24305@porthos.cc.bellcore.com>
- References: <1992Nov10.231657.17411@morwyn.uucp> <1992Nov11.134119.15928@porthos.cc.bellcore.com> <1992Nov11.150851.10057@news.eng.convex.com>
- Sender: netnews@porthos.cc.bellcore.com (USENET System Software)
- Lines: 36
-
- In article <1992Nov11.150851.10057@news.eng.convex.com> tchrist@convex.COM (Tom Christiansen) writes:
- >You shouldn't have to open a pipe to uudecode. unpack('u', $datum)
- >should suffice.
- >
- >--tom
-
- Ok, I didn't know about the 'u' option to unpack. I submit the
- following.
-
- -Roe
-
- ================cut here================
- #! /usr/local/bin/perl -S
- #extract will scan for uuendcoded stuff and uudecode it into the right file
- line: while (<>) {
- if(/^BEGIN/){
- $p = 'y';
- next line;
- }
- if(/^END/){
- $p = 'n';
- }
- if(/^begin/) {
- ($begin,$mode,$file)=split;
- open(OUT,">$file");
- }
- close OUT if(/^end/);
- if( /^begin/ || /^end/ || /Subject/ ){
- print stderr $_;
- }
- if($p eq 'y'){
- print OUT unpack('u',$_);
- }
- }
- Roe D McBurnett III Bellcore (908)699-2273 rdm2@chaucer.cc.bellcore.com
- #insert <std.disclamer>
-