Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: Extracting web data

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


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

Did you uncomment the if statement and comment the other print? The code I posted cannot print non numeric data. If the regular expression I provided does not match anything then please provide exactly what $foo->identifiers() prints.

Replies are listed 'Best First'.
Re^4: Extracting web data
by Anonymous Monk on Jun 13, 2011 at 17:02 UTC

    Yes, I did uncomment the if statement and comment the other print. But, I didn't get any output. $foo-> identifiers() prints the following output.

    PMID: PMID: 4012367

    it prints this if its only PMID else, if there are two identifiers it prints both the doi and the PMID as follows

    PMID: doi:10.1093/fampra/cmq003PMID: 20215333

      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.

        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://909396]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-24 19:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found