#perl - Fri 4 May 2007 between 00:55 and 01:05



Chris62vwf00li5h, aha
aha! right on, thanks
revdiabloif ( first { $_ eq $ip } @ip_list ) { ... }
Chris62vwopoftheuniverse, if you're lazy like me you can use the "first" function found in the List::Util module
I think I used to make my own sub contains, I must be confusing it with that
opoftheuniversei need to check
Chris62vwactually, mine would look like this: if ( contains($str, @stuff) )
siliChris62vw: squid is dumping core
Chris62vwsili, well wtf
f00li5hChris62vw: grep?
Chris62vwf00li5h, would use a for loop
f00li5hif (grep $_ eq $ip, @whitelst)
revdiabloAh, EXPR form of grep
jdv79did you guys see that Bugzilla guy whining about how its Perl's fault they're having trouble?
revdiabloHow I loathe it so
siliChris62vw: ah, needed squid -z
f00li5hi believe that grep knows it's being used in scalar context, and gives up early
s/scalar/boolean/
Chris62vwsili, oh yeah. whoops
revdiablof00li5h: I don't think so
Chris62vwFosforo, I think it just doesn't bother with returning something
er, f00li5h
revdiablof00li5h: In fact it's documented not to be so
f00li5h: It returns the number of matches in scalar context
f00li5hrevdiablo: oh, right.
rmahonly got a score of 90 :-(
f00li5hrevdiablo: but it doesn't build the list
Chris62vwsub contains { my ($str, @stuff) = @_; for (@stuff) { $str eq $_ and return 1 } return 0 } something like that...
opoftheuniverseChris62vw: if ( contains($str, @stuff) ) this will only check if its there
Chris62vwopoftheuniverse, oh, no need to make your own sub contains like I did, but you can.
opoftheuniverse, right
opoftheuniverseChris62vw: I need another check to see if some ip are not in a array
Chris62vwit checks to see if a certain thing is in a list of things
opoftheuniverse, well, return 0 instead of 1 and return 1 instead of 0, respectively, or use unless or ! or not instead of if :-)
print "$ip_address is fine" unless contains($ip, @list); # just change your logic!
f00li5h$ip = filter_blocked_ips( $ip ); # returns an empty list if given one bad IP
imagine you are uploading a movie as a torrent, do you A) stick it all in one movie file or B) stick it in 25 .rar parts FOR EACH DVD?!
revdiabloCan I do 25 rar parts plus a l33t autoextractor with a trojan horse?
f00li5hrevdiablo: you sure can
actionf00li5h tries to play the film and gets another porno toolbar installed in IE
f00li5htries to play the film and gets another porno toolbar installed in IE

Page: 5 12 19 26 33 40 47 54 61 68 75 82 89 96 103 110 

IrcArchive