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:

for ($info) { #filter out all the adds and links s/$nummer//gi; s/<.*?>//g; ... }
Saves a lot of typing.

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.