On 4/5/10 Mon Apr 5, 2010 2:56 PM, "Doug Cacialli"
scribbled:
> I sincerely appreciate the tips on improving my code; I implement (or
> at least take strong note) of all the suggestions I receive. In the
> code I posted, however, I'm primarily interested in learning if
> there's a way to avoid
I sincerely appreciate the tips on improving my code; I implement (or
at least take strong note) of all the suggestions I receive. In the
code I posted, however, I'm primarily interested in learning if
there's a way to avoid opening the file to determine the character
encoding, and then opening it
Doug Cacialli wrote:
$datapath =~ s/^\s+//;
$datapath =~ s/\s+$//;
Alternative notation:
s/\s+$//, s/^\s+// for $datapath;
I have a "sub trim()" in my Toolbox, so I just call "trim($datapath);".
open (my $filehndl , "<", "$datapath") ||
die ("Can't open .txt file $datapath. Ex
Jeff Pang schreef:
> [processing .h files]
> next if $file eq '.' or $file eq '..';
> next if $file !~ /\.h$/;
Those two lines can be replaced by
file =~ /\.h$/ or next;
> return $. if /$string/;
If the string can contain regex-special characters, then always use
quote
On Thu, 2007-02-22 at 23:20 +0530, Dharshana Eswaran wrote:
> I forgot to mention, First step is to Search for the file in which the
> string occurs
A list of files use either function glob or opendir (perldoc -f ???)
I wonder how you are going to check for a string without opening it.
You may
>> I need to search a particular string in a set of files in a directory. The
>> string appears only in one of the files in the directory.
>> I need to retrieve the file name and then access the line of that
>> particular file in which the string occurs.
>>
>> NOTE: The perl script also resides i
On 2/22/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote:
I need to search a particular string in a set of files in a directory. The
string appears only in one of the files in the directory.
I need to retrieve the file name and then access the line of that
particular file in which the string occ
On 2/22/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote:
Hello All,
I need to search a particular string in a set of files in a directory. The
string appears only in one of the files in the directory.
I need to retrieve the file name and then access the line of that
particular file in which th