Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^5: Extracting web data

by zek152 (Pilgrim)
on Jun 13, 2011 at 17:12 UTC ( [id://909412]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Extracting web data
in thread Extracting web data

I took your strings verbatim and ran my regular expression match. Code and results follow:

@strings = ("PMID: PMID: 4012367", "PMID: doi:10.1093/fampra/cmq003PMI +D: 20215333"); for $string (@strings) { if ($string =~ /PMID: (\d+)/) { print "$1\n"; } } #OUTPUT #4012367 #20215333

I'm not exactly sure what your problem is but my code does what I believe you want to accomplish.

Replies are listed 'Best First'.
Re^6: Extracting web data
by smandape1 (Acolyte) on Jun 13, 2011 at 17:48 UTC

    Hey I got it. I did kinda what you did. I am all new to programming and so was a bit messed. Well, I used the following modification and it worked.

    foreach $bar($foo->identifiers()){ if ($bar =~ /PMID: (\d+)/) { print FH "$1\n"; } }

    Thank you for your help. Sammed

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2026-01-19 09:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (122 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.