I am very new to Perl and need your help.
#!c:\perl\bin\perl.exe -w
use strict;
use File::Find;
use Carp;
#variables
my ($directory,$file,$text);
print "Enter search text: ";
$text = <STDIN>;
chomp $text;
$directory = 'c:\my_directory';
find (\&search,$directory);
sub search {
my $file = $File::Find::name;
open (FILE, "$file") or carp "Guess what, it didn't work!\n$!";
my $line = <FILE>;
close FILE;
print "$text - $file"
if $line =~ /$text/;
}
I have numerous errors that I am trying to work my way through, but the one that I am trying to figure out right now is: Permission denied at C:/Perl/lib/File/Find.pm line 450 (I am sure there are several other errors the monks can point out as well :-) ) Find.pm is in that folder and I have full access to it. I found this but I don't know enough to figure out if it is truly related or not. I am using PPM 3.0.1 if that helps.... Any help would be greatly appreciated. Thanks so much! 2006-03-04 Retitled by planetscape, as per Monastery guidelines
Original title: 'Permission Denied'
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|