Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: pattern matching to separate data

by ELISHEVA (Prior)
on May 03, 2009 at 13:29 UTC ( #761578=note: print w/replies, xml ) Need Help??


in reply to pattern matching to separate data

You need to set the record separator to '>', like this: $/='>'. That way each call to <FILE> will get a single record rather than just part of the record. By default $/ is set to the new line and so if you leave your code as is, you are only getting up to the end of each line. See perlvar for more information.

A useful debugging tip is to print out each $line with begin and end markers: print STDERR "##$line##\n". The source of the problem would have been immediately clear had you done that. You might also enjoy this link from someone else who forgot to do that. By pure coincidence, Unbelievably Obvious Debugging Tip just happened to be in today's random pick of Selected Best Nodes

Best, beth

Replies are listed 'Best First'.
Re^2: pattern matching to seperate data
by patric (Acolyte) on May 03, 2009 at 15:20 UTC
    Thanks for your advice..that really worked :)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2021-01-18 15:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?