[clug] C/L's are the bomb. (C/L golf time)

Peter Barker pbarker at barker.dropbear.id.au
Thu May 12 23:29:54 MDT 2011


On Fri, 13 May 2011, Andrew Janke wrote:

> Cop this bit of perl line noise:

ITYM:

# gather dependencies
my @ds = ();
foreach (split/\,/, $depends){
   (m/\*/) && do {
     my($regex) = $_;
     $regex =~ s/\*/\.\*/g;

     print STDOUT "\n\nUSING regex $regex (from: $_)\n\n";

     # search for jids with wildcard
     push @ds, map {
       m/$regex/ ? $jids{$_} : ();
     } sort(keys(%jids));
     next;
   };


   ($_ eq 'none') && do {
     # nothing
     next;
   };

   # add the JID if it exists
   push(@ds, $jids{$_}) if defined($jids{$_});
}
print STDOUT "\nSze: $#ds - :" . join(':', @ds) . ":\n\n";


(it *may* even do what the original code did :-) )

> Almost readable!


TMTOWTII - but only mine is *correct* ;-)


> a

Yours,
-- 
Peter Barker                          |   Programmer,Sysadmin,Geek.
pbarker at barker.dropbear.id.au	      |   You need a bigger hammer.
:: It's a hack! Expect underscores! - Nigel Williams


More information about the linux mailing list