Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Opening and searching .xml file specific strings

by devendrasingh_patil (Initiate)
on Sep 13, 2012 at 06:57 UTC ( #993381=perlquestion: print w/ replies, xml ) Need Help??
devendrasingh_patil has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to open.xml file for reading which does not have uniform data (which can be extracted in Hash) and then want to search for specific string. My code works fine for .txt file. however same is not working for .xml file. Please help Here is a code snippet - my $JobDirectory = 'here is my xml file path'; open FILE, "<$JobDirectory" || die "Can't open log file $!\n"; while (<FILE>) { print "$_\n"; } Here i am providing path of my xml file in $JobDirectory. Want to open the xml file for reading. Above code does not print anything. However, instead of xml file, if i put the path of .txt file, it prints content of that file.

Comment on Opening and searching .xml file specific strings
Re: Opening and searching .xml file specific strings
by davido (Archbishop) on Sep 13, 2012 at 07:01 UTC

    Not enough information has been provided for us to know why it's "not working". ..."not working" isn't an error message. It's not even a description of a problem. It's just an acknowledgement that there is a disconnect between what you expect and what you get.

    Post a minimal code snippet that demonstrates your problem. Post the error message you're getting. Post what output you were expecting, and what output is actually occurring. Then we might be able to answer reasonably well. And chances are that as you work on creating a 10 to 15 line snippet of code to demonstrate to us what's going on, you'll discover the problem along the way yourself.


    Dave

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (16)
As of 2014-07-28 17:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (204 votes), past polls