> foreach my $fileName (@list) { > chomp($fileName); > my $duhFileName = $fileName; > #okay, I need help with scope too :-)
You sure you didn't just misspell the variable name? It's case sensitive..... > if (open SEARCH_FILE, "< $fileName") { > my $searchData = join "", <SEARCH_FILE>; > close SEARCH_FILE; ok, $searchData should be the whole file, but maybe it's the line-based read you're doing. A less attractive but more efficient way is if (open SEARCH_FILE, "< $fileName") { local $_ = undef; $searchData = <SEARCH_FILE>; } That slurps it all in as one big scalar read. > if ($searchData =~ /(\w*\s*\w*$search\w*\s*\w*)/i) { ouch. \w*\s*\w*$search\w*\s*\w* ?? That's zero or more word chars followed by zero or more whitespaces followed by zero or more word chars followed by the search pattern followed by zero or more word chars followed by zero or more whitespaces followed by zero or more word chars. Is there a compelling reason you can't just say /$search/i and then use "$`$&$'" ???? I realize it's not exactly the same, but all those asterisks work the regex engine pretty hard..... I don't suppose /([\w\s]+$search[\w\s]+)/i is specific enough either? Sorry, that may sound critical, which I don't mean. It's just a lot of backtracking if it isn't absolutely necessary. __________________________________________________ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]