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

Re: Deferencing a hash

by graff (Chancellor)
on Oct 29, 2010 at 03:49 UTC ( [id://868221]=note: print w/replies, xml ) Need Help??


in reply to Grep on a list of files in directory

You need to heed the point in the first reply about checking the return value from opendir, because the other reply (about the backslash problem) is probably causing opendir to fail.

But your description is confusing; in the code snippet you say "All the xml files print fine", but at the end you say "why isn't the code printing anything...?" Is it printing xml file names or not?

Also, why are you specifically looking for strings containing '/load.c#' (the regex in the 2nd grep call) in a list of file names that end with ".xml" extensions? Do you actually have xml files with '/' and '#' (and "load.c" in between) as part of the file names?

Updated to fix misspelling in the regex in the 3rd paragraph. Also, what is the relevance of the thread title? That is, how does anything in the OP relate to "Dereferencing a hash"? (I didn't see any hashes in the OP...)

Replies are listed 'Best First'.
Re^2: Deferencing a hash
by iphone (Beadle) on Oct 29, 2010 at 05:03 UTC

    1.Fixed the title 2.xml files print fine at the line mentioned but the grep fails to print anything. i have an xml file with /load.c# in it,am expecting the grep to print it. Is it not printing because we are acutally grepping for the name of the xml files and not the content in it.????

      Yes. Grep looks for the value in $_, which are filenames that end in .xml .

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (6)
As of 2024-04-24 09:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found