Also, use strict and use warnings may provide useful information. You should add some error checking to opendir. Show us the actual code that youve tried, and then describe what happened and whats not right, and then we can help you from there. Take a look anyway for an example of the error checking. Try writing something yourself and then if it doesnt work, show us specifically what you did so we can help you along. It doesn't return a list! My apologies - it does in list context. Grep looks for the value in $_, which are filenames that end in. Is it not printing because we are acutally grepping for the name of the xml files and not the content in it.? I have an xml file with /load.c# in it,am expecting the grep to print it. 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.)Ģ.xml files print fine at the line mentioned but the grep fails to print anything. Updated to fix misspelling in the regex in the 3rd paragraph. print0 tells find to print a null character after each file it finds xargs -0 reads from standard input and runs the. You have to escape the first so that the shell does not interpret it. 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.īut 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?Īlso, 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? eml.gz files in the current directory, you can use: find.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |