in reply to Filtering one array using another array
#!/usr/bin/perl # example blacklisting @sites = ( "http://www.rtfm.com", "http://www.alottatax.com", "http://www.kingdom.com/cgi-bin/script.pl" ); @blacklist = ( "cgi", "blabla", "testme" ); foreach $site (@sites) { &blacklist(); } sub blacklist { foreach $blacklist (@blacklist) { if ( $site =~ m/$blacklist/gi ) { print "$site blacklisted - $blacklist\n"; return; #Change1 } else { print "$site ok\n"; return; #Change2 } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Filtering one array using another array
by teabag (Pilgrim) on Sep 04, 2003 at 13:53 UTC | |
|
Re: Re: Filtering one array using another array
by Kimi_1973 (Initiate) on Sep 04, 2003 at 13:50 UTC |