Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

web spider

by jeadge (Initiate)
on Mar 23, 2006 at 13:44 UTC ( [id://538740]=perlquestion: print w/replies, xml ) Need Help??

jeadge has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: web spider
by monkey_boy (Priest) on Mar 23, 2006 at 13:55 UTC
    Use a regex, see the docs
    for my $email (@addresses) { if ($email =~ m/^(.*?)ulster.ac.uk/) { print $1 , "\n"; }; };



    This is not a Signature...
Re: web spider
by socketdave (Curate) on Mar 23, 2006 at 14:04 UTC
    When posting this type of question, you'll generally get a better response if you take a shot and post the code that's not working for you. That said, you might want something like this:
    map s/\@ulster\.ac\.uk//, @your_array;
    or
    map s/\@ulster\.ac\.uk//g, @your_array;
    if there is a possibility that an array element will hold more than one email address.

    Take some time and look up 'map' and s///. There is MTOWTDI, and there are more basic solutions to this problem.
Re: web spider
by Anonymous Monk on Mar 24, 2006 at 05:22 UTC
    Of course, regexes aren't the only way to go:
    #!perl -l print substr($_, 0, index($_, '@')) for @emails;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://538740]
Approved by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-20 02:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found