use LWP::UserAgent;
I should have used LWP::Simple and so should you :)
This is copy/paste-programming, I think. I used LWP::UA because some earlier version did some extra work, but I guess you just copied my code. My bad code.
sub Jammer_hoor {
Subs should be declared before they're used, in my opinion. Especially when the name of the sub is useless. Why the capital J, by the way?
if ( $nummer !~ m/\b\d{3}-\d{7}\b/ ) {
So !!!!!!!!!!!!!!hallo wereld!!!!!!@#$@#$%^#$%^#$%^#"$%#$%#"$%"#$%#$%"#$%123-4567890!!!!!!!!!! is a valid Dutch phone number? Besides that, it's possible to have a three-digit area number and a 6-digit subscriber number. With 06 number's it's 2-8, even.
if ( $info !~ m/Naam:/g ) {
I think explicit m with // as delimiters is misleading. As misleading as any of q'' qq"" qx`` m//. Explicit code isn't always clearer.
$info =~ s/\s+/ /gi;
Why /i? Afraid there will be uppercased whitespace? For all your regexes: only use modifiers that are useful for that regex.
#filter out all the adds and links $info =~ s/$nummer//gi; $info =~ s/<.*?>//gi; $info =~ s/\.\.\..*?\.\.\.//gi; $info =~ s/\{.*?\}//gi; $info =~ s/\(.*?\)//gi; $info =~ s/table.*?://gi; $info =~ s/1\ item.*?sp\;//gi; $info =~ s/2\ item.*?sp\;//gi; $info =~ s/\s+/ /gi; #format for easy cut 'n paste $info =~ s/Telnr: /\n/g; $info =~ s/Naam: /\n/g; $info =~ s/Adres: /\n/g; $info =~ s/Plaats: /\n/g; $info =~ s/Postcode: /\n/g; $info =~ s/Fax: /\nfax: /g;
You can topicalize using for:
Saves a lot of typing.for ($info) { #filter out all the adds and links s/$nummer//gi; s/<.*?>//g; ... }
print "$info";
Get rid of those quotes. You're stringifying a string, copying the value in memory more often than necessary.
Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }
In reply to Re: Poor man's Foongrep for dutch telephonenumbers
by Juerd
in thread Poor man's Foongrep for dutch telephonenumbers
by teabag
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |