Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tlug: perl is better?



Hi all,

When you request majordomo to send a tlug monthly archive file
it arrives with a pesky >From line that MHonARC ignores (meaning
it thinks there are no new files to read because the line starts
with a >)

Being lazy (and knowing sed better than perl) I got rid of them
with 

$ cat tlug.9802 | sed 's/^>From/From/' > tlug.9802.s

But later, I decided to try the same thing with perl and
couldn't get it to work. So I put the sed script in a file and:

schweiz:~$ s2p sed.test
#!/usr/bin/perl
eval 'exec perl -S $0 ${1+"$@"}'
        if $running_under_some_shell;

while ($ARGV[0] =~ /^-/) {
    $_ = shift;
  last if /^--/;
    if (/^-n/) {
        $nflag++;
        next;
    }
    die "I don't recognize this switch: $_\\n";
}
$printit++ unless $nflag;

$\ = "\n";              # automatically add newline on print

LINE:
while (<>) {
    chop;
    s/^>From/From/;
    print if $printit;
}

which to me looks more like an entry in an obfuscated perl
contest than a quick "let's get rid of a >" script.

Is there a better (ie more understandable to a non-programmer)
way to get perl to do this?

Regards,

Jim S.

----------------------------------
Jim Schweizer <schweiz@example.com>
#include <disclaimer.h>
My life is a patio of fun!
http://www1.harenet.or.jp/~schweiz/
----------------------------------
---------------------------------------------------------------
Next TLUG Meeting: 11 April Sat, Tokyo Station Yaesu gate 12:30
Featuring Tague Griffith of Netscape i18n talking on source code
---------------------------------------------------------------
a word from the sponsor:
TWICS - Japan's First Public-Access Internet System
www.twics.com  info@example.com  Tel:03-3351-5977  Fax:03-3353-6096



Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links