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

Who can make this script smaller?



Maarten van Steenbergen writes:
 > Does someone know how to make this script smaller?
 > Why?
 > For fun!!

I think

perl -e 'undef$/;$_=<>;print"$&
"while/<A[^<]*?<\/A>/gsi'

is functionally equivalent at 58 chars with newline(s).  Any advance
on that? :-)

Seriously though, I feel that

    #!/usr/bin/perl -w

    $/ = undef;
    $_ = <>;

    while (/ < \s* A \s+ [^>]* HREF \s* = .*? \/ \s* A \s* > /gxsi) {
      print "$&\n";
    }

is going to be a bit more bulletproof, and it's only about 2.5 times
longer.
-
European Universities' Linux User Groups -- Misc list
http://humbolt.geo.uu.nl/eulug/