in reply to Re: Re: Compressing .sigs more
in thread Compressing .sigs more
Actually, this is two attempts. After playing around with my original twist a couple of times, i found that to do what it needs to do it would have to be longer than your original code. So i instead took your original code and chopped off unimportant bits and did some reformatting. Both of the following snippets seem to test out correctly (using warnings and strict):
The first one is based off of yours, i'm sure there's a way to squeeze it further, but i can't see it from here. The second is a re-working of my previous answer, and is obviously inadequate space-wise./^Received[^\[]+\[(\d+).(\d+).(\d+).(\d+)]/?`host $4.$3. $2.$1.$ARGV[0] 2>&1`=~/$ARGV[1]/m&&exit 0:1while<STDIN>; exit 1 while(<STDIN>){s/^Received[^\[]+//&&s/].*//?($_='host ' .(join'.',(reverse map{s/(\D+)//;$_}split/\./),$ARGV[0] ).' 2>&1',`$_`=~/$ARGV[1]/m&&exit 0):1}exit 1
Hope This Helps,
jynx
PS i'm not sure how space-conscientious you want to be, but you could also shorten the first line to:
if you're really desperate for space. As always, it could probably be shortened more... :)eval join"",map{chop;s/^[^>]+>\s*//&&$_}<DATA>__END__
|
|---|