| Chris62vw | f00li5h, aha aha! right on, thanks |
| revdiablo | if ( first { $_ eq $ip } @ip_list ) { ... } |
| Chris62vw | opoftheuniverse, 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 |
| opoftheuniverse | i need to check |
| Chris62vw | actually, mine would look like this: if ( contains($str, @stuff) ) |
| sili | Chris62vw: squid is dumping core |
| Chris62vw | sili, well wtf |
| f00li5h | Chris62vw: grep? |
| Chris62vw | f00li5h, would use a for loop |
| f00li5h | if (grep $_ eq $ip, @whitelst) |
| revdiablo | Ah, EXPR form of grep |
| jdv79 | did you guys see that Bugzilla guy whining about how its Perl's fault they're having trouble? |
| revdiablo | How I loathe it so |
| sili | Chris62vw: ah, needed squid -z |
| f00li5h | i believe that grep knows it's being used in scalar context, and gives up early s/scalar/boolean/ |
| Chris62vw | sili, oh yeah. whoops |
| revdiablo | f00li5h: I don't think so |
| Chris62vw | Fosforo, I think it just doesn't bother with returning something er, f00li5h |
| revdiablo | f00li5h: In fact it's documented not to be so f00li5h: It returns the number of matches in scalar context |
| f00li5h | revdiablo: oh, right. |
| rmah | only got a score of 90 :-( |
| f00li5h | revdiablo: but it doesn't build the list |
| Chris62vw | sub contains { my ($str, @stuff) = @_; for (@stuff) { $str eq $_ and return 1 } return 0 } something like that... |
| opoftheuniverse | Chris62vw: if ( contains($str, @stuff) ) this will only check if its there |
| Chris62vw | opoftheuniverse, oh, no need to make your own sub contains like I did, but you can. opoftheuniverse, right |
| opoftheuniverse | Chris62vw: I need another check to see if some ip are not in a array |
| Chris62vw | it 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?! |
| revdiablo | Can I do 25 rar parts plus a l33t autoextractor with a trojan horse? |
| f00li5h | revdiablo: you sure can |
| action | f00li5h tries to play the film and gets another porno toolbar installed in IE |
| f00li5h | tries to play the film and gets another porno toolbar installed in IE |