Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!samsung!know!zaphod.mps.ohio-state.edu!brutus.cs.uiuc.edu!apple!sun-barr!newstop!sun!stef From: stef@zweig.sun (Stephane Payrard) Newsgroups: comp.lang.perl Subject: extracting a script from a mail/article Message-ID: Date: 14 Aug 90 00:17:22 GMT Sender: news@sun.Eng.Sun.COM Distribution: comp.lang.perl Organization: Sun Microsystems -- Mountain View Lines: 32 Howdy, I have yet to see a perl switch which allows to save a perl script part of other informations... as opposed to -x which executes the script. Here is a script which does just that... to be extracted with 'perl -x' (for kicks). perl 3.0 patch level 27 required. Feed 'perl -x > filename' with the contents of this article to save the script in the file filename. Make the saved script executable. Piping a mail/article with the saved script gives you the embedded script on sdtout. It assumes that there is only one perl-script embedded (ie: the current article does not match this definition). #! /usr/bin/perl -n (/^#!/../^__END__/ )&& print $_; __END__ #! /usr/bin/perl -n (/^#!/../^__END__/ )&& print $_; __END__ stef -- Stephane Payrard -- stef@sun.com -- (415) 336 3726 Sun Microsystems -- 2550 Garcia Avenue -- M/S 10-09 -- Mountain View CA 94043