[30410] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1653 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 18 00:09:43 2008

Date: Tue, 17 Jun 2008 21:09:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 17 Jun 2008     Volume: 11 Number: 1653

Today's topics:
    Re: Help with Hash of Hashes xhoster@gmail.com
    Re: Learning Perl <sbour@niaid.nih.gov>
    Re: Learning Perl <kkeller-usenet@wombat.san-francisco.ca.us>
    Re: Learning Perl <jurgenex@hotmail.com>
    Re: Learning Perl <sbour@niaid.nih.gov>
    Re: Learning Perl <whynot@pozharski.name>
    Re: Learning Perl <kkeller-usenet@wombat.san-francisco.ca.us>
    Re: Perl Script <akhilshri@gmail.com>
    Re: Reading whole file into memory. Parsing 'C' like fi xhoster@gmail.com
    Re: Reading whole file into memory. Parsing 'C' like fi <ben@morrow.me.uk>
    Re: Reading whole file into memory. Parsing 'C' like fi xhoster@gmail.com
    Re: Reading whole file into memory. Parsing 'C' like fi <cartercc@gmail.com>
        Search.bat from the command line bdy120602@gmail.com
    Re: Search.bat from the command line <brian.helterline@hp.com>
    Re: Search.bat from the command line <usenet@davidfilmer.com>
    Re: Search.bat from the command line bdy120602@gmail.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 17 Jun 2008 18:55:58 GMT
From: xhoster@gmail.com
Subject: Re: Help with Hash of Hashes
Message-Id: <20080617145600.357$EW@newsreader.com>

Kevin Brammer <kncbram@mapson.hawaii.rr.com> wrote:
> nolo contendere wrote:
>
>  > [snip]
> > For the record, I agree with bugbear that a more appropriate data
> > structure would be a hash of arrays.
>
> Thanks for the replies everyone.
>
> The only problem with a hash of arrays is I need to be able to lookup
> the values by name.  For example, I need to be able to pull 00-00AAAA,
> entry2 ($HoH{$item}{$entry})  independently.

But people are suggesting a hash of array, not an array of array.

You have:
$HoH{$item}{$entry_as_string_with_number_prepended_by_fixed_string}
you could do:
$HoA{$item}[$entry_as_actual_number]



> I suppose I could go
> searching through the array for the particular hash item, but it just
> seems more efficient to call it.

Maybe your real world second level structure isn't as simple as your
example "entry1", "entry2", "entry3" and they have real meaningful names
instead, or maybe that format is mandated by some other part of the code
you can't change, but generally I'd say you should strip off the silly
"entry" part and just use the numeric part (but changing them to start with
0 rather than 1), and then since you are using integers, use an array
rather than a hash for the second level.  The first level, of course, stays
a hash.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.


------------------------------

Date: Tue, 17 Jun 2008 13:24:57 -0700
From: "Stephan Bour" <sbour@niaid.nih.gov>
Subject: Re: Learning Perl
Message-Id: <w4V5k.4402$L_.933@flpi150.ffdc.sbc.com>

Uri Guttman wrote:
} >>>>> "SB" == Stephan Bour <sbour@niaid.nih.gov> writes:
}
}
} > Agreed. Every thread I see Uri jump into recently seems to turn
} > into a flame pit. I wish he would grow up and learn to make
} > civilized responses so this group can carry decent discussions
} > instead of escalating into childish scuffles.
}
} i don't start flame wars.

Yes you do.

} this thread was a post about a flash card perl thing. i reviewed it
} like i review all things like it, hard and accurately. that is part of my
} work and i take it seriously. gordon troll then jumps in to defend
} things and attacks my comment style as usual. he is also wrong on
} several counts. then he defends defined on aggregates where he is very 
wrong
} and pigheaded to the point of ignoring what the docs say about it
} being deprecated. he think and flames it is useful. that is not what
} i call civil as it is just stupid. but that is gordo who changes his
} name all the time and doesn't listen to those who know perl a wee bit
} better.

I never saw Gordon do anything wrong; all I saw him do was make a point 
about something and then you once again jumped onto his back for no reason. 
Then when you recount event, you twist around reality so much I think you're 
actually starting to believe your own lies.

Stop bullying people and get a hobby. Stop inciting flame wars and leave 
your grievances at the door and grow up.


Stephan. 




------------------------------

Date: Tue, 17 Jun 2008 13:52:32 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: Learning Perl
Message-Id: <hpkli5xp8v.ln2@goaway.wombat.san-francisco.ca.us>

On 2008-06-17, Stephan Bour <sbour@niaid.nih.gov> wrote:
>
> I never saw Gordon do anything wrong;

''Gordon'' has been doing many things wrong for some time now; while Uri
and the rest of us would probably be better off ignoring him (would you
argue with the-japanese-lizard-which-shall-not-be-named about these
topics?), Gordon clearly can not claim the moral high ground here.
(Have you read his justification of his morphing?  If that's not a clear
troll indicator I don't know what is.)

--keith

-- 
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information



------------------------------

Date: Tue, 17 Jun 2008 22:51:11 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Learning Perl
Message-Id: <65fg545a9mvd68c7sc87uls4e2621rgv59@4ax.com>

Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us> wrote:
>On 2008-06-17, Stephan Bour <sbour@niaid.nih.gov> wrote:
>>
>> I never saw Gordon do anything wrong;
>
>''Gordon'' has been doing many things wrong for some time now; while Uri
>and the rest of us would probably be better off ignoring him (would you
>argue with the-japanese-lizard-which-shall-not-be-named about these
>topics?), Gordon clearly can not claim the moral high ground here.
>(Have you read his justification of his morphing?  If that's not a clear
>troll indicator I don't know what is.)

Also it is worthwhile to point out that recently a few new names popped
up, which have never been heard of before  in this group (that is
interesting but _not_ suspicious) except to argue in favour of Mr. Etly
(that _is_ suspicious). 

jue


------------------------------

Date: Tue, 17 Jun 2008 18:14:02 -0700
From: "Stephan Bour" <sbour@niaid.nih.gov>
Subject: Re: Learning Perl
Message-Id: <ujZ5k.8613$jI5.2088@flpi148.ffdc.sbc.com>

Jürgen Exner wrote:
} Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us> wrote:
} > On 2008-06-17, Stephan Bour <sbour@niaid.nih.gov> wrote:
} > >
} > > I never saw Gordon do anything wrong;
} >
} > ''Gordon'' has been doing many things wrong for some time now;

Then please, give an example.

} > while Uri and the rest of us would probably be better off ignoring him

Who are "the test of us" ?

} > (would you argue with the-japanese-lizard-which-shall-not-be-named
} > about these topics?),

Which topics?

} > Gordon clearly can not claim the moral high ground here.

As far as I can tell, neigher can someone who keeps insulting people.

} > (Have you read his justification of his morphing?  If
} > that's not a clear troll indicator I don't know what is.)

Maybe you should define what you mean by "morphing"? This would appear to be 
one of those terms with varying definitions.

In his case, he changed his email, not his name. I've always known 
"morphing" to mean someone who changes either their name or both their name 
& email address, but not changing their email address alone.

That aside, what appears to be happening here is people like Uri ganging up 
on this guy because they are not seeing eye to eye. This to me is just 
wrong. Uri is not new to this news group not Usenet, so I would expect a bit 
more maturity from him.

}  Also it is worthwhile to point out that recently a few new names
}  popped up, which have never been heard of before  in this group (that
}  is interesting but _not_ suspicious) except to argue in favour of Mr.
}  Etly (that _is_ suspicious).

On Usenet many people like yourself and Uri use words like "troll" much to 
easily. I don't think it was ever meant to be a crutch to be used by people 
of influence to win arguments and discredit those they do not agree with. 
Like with any term that's over used, it becomes ever the more meaningless.


Stephan. 




------------------------------

Date: Tue, 17 Jun 2008 21:38:00 +0300
From: Eric Pozharski <whynot@pozharski.name>
Subject: Re: Learning Perl
Message-Id: <8tcli5x4uh.ln2@carpet.zombinet>

A. Sinan Unur <1usa@llenroc.ude.invalid> wrote:
> Eric Pozharski <whynot@pozharski.name> wrote in
> news:os4ki5xndf.ln2@carpet.zombinet: 

*SKIP*
>> Thanks, thanks, thanks.

> <blockquote>
> perldoc perldata

Pity on me.  I've overlooked that completely.  Gone for reading.

*CUT*

-- 
Torvalds' goal for Linux is very simple: World Domination


------------------------------

Date: Tue, 17 Jun 2008 20:43:22 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: Learning Perl
Message-Id: <rrcmi5x4r3.ln2@goaway.wombat.san-francisco.ca.us>

On 2008-06-18, Stephan Bour <sbour@niaid.nih.gov> wrote:
> Jürgen Exner wrote:
> } Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us> wrote:
> } >
> } > ''Gordon'' has been doing many things wrong for some time now;
>
> Then please, give an example.

The many morphings; the nitpicking over the documentation without
writing a patch; the not actually reading the documentation while
arguing about what Perl functions actually do.  Is that enough?

> } > while Uri and the rest of us would probably be better off ignoring him
>
> Who are "the test of us" ?

"The rest of us" is everyone who posts to clpmisc.

> } > (would you argue with the-japanese-lizard-which-shall-not-be-named
> } > about these topics?),
>
> Which topics?

See above.

> Maybe you should define what you mean by "morphing"? This would appear to be 
> one of those terms with varying definitions.

Surprisingly enough, I couldn't find a definition in the jargon file.
The definitions I use are "changing one's headers in an attempt to evade
killfiles" or "changing one's headers excessively".  The From: header
is the header I see most commonly morphed.

> In his case, he changed his email, not his name. I've always known 
> "morphing" to mean someone who changes either their name or both their name 
> & email address, but not changing their email address alone.

I hope you're not seriously buying this argument (if so, I'd have to
consider seriously whether you are actually ''Gordon'' hiding behind yet
another alias).  There is no Name: header.  There is no Email: header.
There is just the From: header (and the Reply-To: header, which is used
much less frequently).  Since most clients killfile first on the From:
header, changing it, whether the name or the email address, circumvents
any killfile entries people have made with the original From: header.

I can already hear your response: but you can use a regexp in killfiles!
Sure, but I find that I seldom need a regexp except for real trolls.

(And, by the way, ''Gordon'' has already used at least three different
versions of his name; I have a hard time coming up with a reasonable
explanation for this morphing.)

> That aside, what appears to be happening here is people like Uri ganging up 
> on this guy because they are not seeing eye to eye. This to me is just 
> wrong.

I agree.  In general, replies should be mostly civil; since it's not
generally possible to be civil with a troll, they should be ignored
except to correct blatant errors in their posts (which ''Gordon'' seems
to make less frequently, though still at a nonzero rate, than other
trolls).

> On Usenet many people like yourself and Uri use words like "troll" much to 
> easily. I don't think it was ever meant to be a crutch to be used by people 
> of influence to win arguments and discredit those they do not agree with. 
> Like with any term that's over used, it becomes ever the more meaningless.

Have you come to this conclusion based on an extensive research of mine
(and Uri's) posting history?  Because by my count I have about five in
my killfile.  I wouldn't call that excessive, would you?  (Contrast this
with the other section I have of people I just plain dislike; I would
not call these people trolls, just jerks.  This section is shockingly
large.)  (Interestingly enough, it's about five different personalities,
but they take about 20 lines in my killfile, because of morphing.  Even
more interestingly, the variable that changes the most is the email
address.)

(And I'm flattered that you seem to think I am a person of influence,
but I can tell you, at least in the Perl community, I'm not.)

--keith

-- 
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information



------------------------------

Date: Tue, 17 Jun 2008 15:40:13 -0700 (PDT)
From: dakin999 <akhilshri@gmail.com>
Subject: Re: Perl Script
Message-Id: <e5a2ba99-f697-4e88-9274-41eeec0a03fd@f24g2000prh.googlegroups.com>

On Jun 17, 7:44=A0pm, "Dr.Ruud" <rvtol+n...@isolution.nl> wrote:
> dakin999 schreef:
>
> > 1. Reads from a database(oracle) following columns:
> > Customer_No, Fname, Lname, Password.
>
> > 2. Encrypts the password in SHA1_Base64 format.
>
> You have plain passwords in the database?
>
> --
> Affijn, Ruud
>
> "Gewoon is een tijger."
The passwords are in plain text in the database.


------------------------------

Date: 17 Jun 2008 18:15:50 GMT
From: xhoster@gmail.com
Subject: Re: Reading whole file into memory. Parsing 'C' like file efficently
Message-Id: <20080617141552.310$qF@newsreader.com>

n_macpherson@sky.com wrote:
> I know there are a number of FAQs which disscourage reading whole
> files into memory rather than line by line.

I hope the discourage you from reading whole files into memory
thoughtlessly and without good reason.  It seems like you do have a good
reason to read them into memory, so go ahead and do it.  There is even a
module, File::Slurp, to facilitate it.

 ...
>
> Memory won't be an issue - my largest file will only be 6000

Those are famous last words :)

I remember many times when I've said "it will only ever be X large" and
then had to eat those words.  But of course, I suspect there are many many
more times that my statement held true and it never did get much larger,
but those ones don't force themselves back into your attention the way the
other ones do.

>
> I've been away from Perl for a while but I seem to remember there was
> a module File::Tie which might be suitable.

For 6000 lines of code, you should be a long long way from needing
Tie::File. In fact, last time I investigated it, the memory overhead for
Tie::File was so large that, unless your file's lines are very long, much
longer than one generally finds in a computer program, it provided little
memory benefit over slurping the file.

>
> I'd be grateful if anyone has any suggestions -

Don't worry about this particular problem until it has proven itself
to be an issue (which it probably won't)

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.


------------------------------

Date: Tue, 17 Jun 2008 19:54:23 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Reading whole file into memory. Parsing 'C' like file efficently
Message-Id: <vrdli5-lp6.ln1@osiris.mauzo.dyndns.org>


Quoth xhoster@gmail.com:
> n_macpherson@sky.com wrote:
> 
[slurping a file into an array]
> > I've been away from Perl for a while but I seem to remember there was
> > a module File::Tie which might be suitable.
> 
> For 6000 lines of code, you should be a long long way from needing
> Tie::File. In fact, last time I investigated it, the memory overhead for
> Tie::File was so large that, unless your file's lines are very long, much
> longer than one generally finds in a computer program, it provided little
> memory benefit over slurping the file.

One major advantage of Tie::File is that the interface is exactly the
same as a slurped array, so if/when memory does become a problem, you
can simply replace

    use File::Slurp qw/read_file/;

    my @data = read_file 'name';

with

    use Tie::File;

    tie my @data, 'Tie::File', 'name' or die "can't read 'name': $!";

and leave the rest of the code unchanged.

Ben

-- 
Many users now operate their own computers day in and day out on various
applications without ever writing a program. Indeed, many of these users
cannot write new programs for their machines...
    -- F.P. Brooks, 'No Silver Bullet', 1987             [ben@morrow.me.uk]


------------------------------

Date: 17 Jun 2008 19:48:54 GMT
From: xhoster@gmail.com
Subject: Re: Reading whole file into memory. Parsing 'C' like file efficently
Message-Id: <20080617154856.909$Zt@newsreader.com>

Ben Morrow <ben@morrow.me.uk> wrote:
> Quoth xhoster@gmail.com:
> > n_macpherson@sky.com wrote:
> >
> [slurping a file into an array]
> > > I've been away from Perl for a while but I seem to remember there was
> > > a module File::Tie which might be suitable.
> >
> > For 6000 lines of code, you should be a long long way from needing
> > Tie::File. In fact, last time I investigated it, the memory overhead
> > for Tie::File was so large that, unless your file's lines are very
> > long, much longer than one generally finds in a computer program, it
> > provided little memory benefit over slurping the file.
>
> One major advantage of Tie::File is that the interface is exactly the
> same as a slurped array, so if/when memory does become a problem, you
> can simply replace
>
>     use File::Slurp qw/read_file/;
>
>     my @data = read_file 'name';

This uses 3 times as much memory as reading in the file in a while loop
and pushing it into the array.  It seems like it should only be two times
as much, but it isn't (And it is 1.5 times as much @data=<$fh> takes).  Of
course, most of that excess memory is eligible for later reuse, provided
your program survives and needs it.

>
> with
>
>     use Tie::File;
>
>     tie my @data, 'Tie::File', 'name' or die "can't read 'name': $!";
>
> and leave the rest of the code unchanged.

But my lament is that this just doesn't save all that much memory over
an already efficient slurping method, due to the overhead of Tie::File's
internal structures.  I checked again on the latest Tie::File, and based on
vague recollections it does seem substantially better than the older one I
played around with, but still the memory overhead is not an insignificant
fraction of what it would be to just slurp a large file of short lines.  So
I consider Tie::File to be an emergency measure I'd throw at a program to
keep it limping along while I redesign and rewrite.  (Not that there is
anything wrong with that)

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.


------------------------------

Date: Tue, 17 Jun 2008 15:26:05 -0700 (PDT)
From: cartercc <cartercc@gmail.com>
Subject: Re: Reading whole file into memory. Parsing 'C' like file efficently
Message-Id: <4e3c419c-51a9-48c0-926a-07a0535d8328@d77g2000hsb.googlegroups.com>

On Jun 17, 6:49 am, n_macpher...@sky.com wrote:
> Say my opening brace is on line 95 and my closing brace 195 I want to
> insert a comment
>
> // for loop ends line 195
>
> at line 94 (i.e immediately above the opening brace). The problem is
> that processing line by line I don't know until I get to line 195 what
> I have to change at line 9 so I have to store lines 94 to 195 in
> memory anyway
>
> Similarly if I read a function header, I want to insert some
> documentation before the function header
> so I don't believe processing the file line by line is the best
> solution here. As I will be inserting extra lines into the middle of
> an array I think I am going to need a module to do this.

I might approach this by matching delimiters. You can certainly match
delimiters and insert comments just above the opening brace. If you
match on key words (for, while, if, else, etc.) and count your lines,
you can create an intermediate file with a comment template just above
the opening brace, and then manually edit for the final program.
Something like this, maybe:

my $line_counter
my @brace_stack #holds info about your block
while(<INFILE>)
   if $_ matches '{'
      $line_counter++
      push $brace_stack[n]
      print OUTFILE "// COMMENT"
      print OUTFILE $_
   if $_ matches '}'
      $line_counter--
      pop $brace_stack[n]
      print OUTFILE $_
      print OUTFILE "// COMMENT"

Obviously, your logic would depend on your coding standard. I wrote
something similar in Java and developed a class that would do
something similar. Perl ought to be a lot easier.

CC


------------------------------

Date: Tue, 17 Jun 2008 14:43:29 -0700 (PDT)
From: bdy120602@gmail.com
Subject: Search.bat from the command line
Message-Id: <210080b1-66f8-4362-b9b7-4ef369b7c779@x35g2000hsb.googlegroups.com>

I'm doing a search from the DOS prompt using the Perl search function
and I would like to search for a special character ($), but the Perl
command doesn't seem to be able to find it. I surround the dollar sign
in quotation marks, and it listed all the files in the directory,
which led me to believe that it couldn't initiate the search properly
because not all the documents contain the $. If I use search from the
Perl command line, meaning after I type "Perl" at the commadn prompt,
I receive

search/"$"
Final $ should be \$ or $name at - line 1, within string
syntax error at - line 1, near "/"$""

Also, I'm searching RTF files. which have HTML coding behind them. Is
there anyway to have Perl search just the text and not the code?

Thanks.


------------------------------

Date: Tue, 17 Jun 2008 14:53:41 -0700
From: Brian Helterlilne <brian.helterline@hp.com>
Subject: Re: Search.bat from the command line
Message-Id: <g39bp7$jfj$1@usenet01.boi.hp.com>

bdy120602@gmail.com wrote:
> I'm doing a search from the DOS prompt using the Perl search function
> and I would like to search for a special character ($), but the Perl
> command doesn't seem to be able to find it. I surround the dollar sign
> in quotation marks, and it listed all the files in the directory,
> which led me to believe that it couldn't initiate the search properly
> because not all the documents contain the $. If I use search from the
> Perl command line, meaning after I type "Perl" at the commadn prompt,
> I receive
> 
> search/"$"
> Final $ should be \$ or $name at - line 1, within string
> syntax error at - line 1, near "/"$""

perl doesn't have a search function.  I think you mean you have a perl 
program called search.pl that searches files.

Since you haven't shown us the code, it is hard to tell what the problem 
is, but an educated guess is that your program is using regular 
expressions to locate the search string.  the '$' character is special 
within a regular expression.  Depending on what you want, you can either 
escape it within the string \$ or modify the program to not treat any 
characters as special within the RE (e.g. \Q$string)

> 
> Also, I'm searching RTF files. which have HTML coding behind them. Is
> there anyway to have Perl search just the text and not the code?

you would need to parse the file using one of the many HTML parsing modules.

> 
> Thanks.

-- 
-brian


------------------------------

Date: Tue, 17 Jun 2008 15:02:25 -0700
From: David Filmer <usenet@davidfilmer.com>
Subject: Re: Search.bat from the command line
Message-Id: <GMGdnUpyH77TqcXVRVn_vwA@giganews.com>

bdy120602@gmail.com wrote:
> I'm doing a search from the DOS prompt using the Perl search function

Ah, I see your problem right there.  Perl doesn't HAVE a search function 
(it does have a s/// regular expression, but that doesn't seem to be 
related to your question).

> If I use search from the
> Perl command line, meaning after I type "Perl" at the commadn prompt,
> I receive
> 
> search/"$"
> Final $ should be \$ or $name at - line 1, within string

The message is telling you something useful.  Either the dollar-sign 
should be escaped (\$) or it should precede a variable name ($name). You 
surely want to escape it (to treat it as a string-literal) but I don't 
know why you're trying to do that division operation.

I suspect you are trying to run some Perl script and pass input.  Show 
us the relevant part of the script.


-- 
David Filmer (http://DavidFilmer.com)
The best way to get a good answer is to ask a good question.


------------------------------

Date: Tue, 17 Jun 2008 18:32:33 -0700 (PDT)
From: bdy120602@gmail.com
Subject: Re: Search.bat from the command line
Message-Id: <83230477-344e-448a-8416-6bf1981afb4b@w7g2000hsa.googlegroups.com>

On Jun 17, 5:53=A0pm, Brian Helterlilne <brian.helterl...@hp.com> wrote:
> bdy120...@gmail.com wrote:
> > I'm doing a search from the DOS prompt using the Perl search function
> > and I would like to search for a special character ($), but the Perl
> > command doesn't seem to be able to find it. I surround the dollar sign
> > in quotation marks, and it listed all the files in the directory,
> > which led me to believe that it couldn't initiate the search properly
> > because not all the documents contain the $. If I use search from the
> > Perl command line, meaning after I type "Perl" at the commadn prompt,
> > I receive
>
> > search/"$"
> > Final $ should be \$ or $name at - line 1, within string
> > syntax error at - line 1, near "/"$""
>
> perl doesn't have a search function. =A0I think you mean you have a perl
> program called search.pl that searches files.
>
> Since you haven't shown us the code, it is hard to tell what the problem
> is, but an educated guess is that your program is using regular
> expressions to locate the search string. =A0the '$' character is special
> within a regular expression. =A0Depending on what you want, you can either=

> escape it within the string \$ or modify the program to not treat any
> characters as special within the RE (e.g. \Q$string)
>
>
>
> > Also, I'm searching RTF files. which have HTML coding behind them. Is
> > there anyway to have Perl search just the text and not the code?
>
> you would need to parse the file using one of the many HTML parsing module=
s.
>
>
>
> > Thanks.
>
> --
> -brian

Oh, OK. Yes, I want to treat the "$" as a string literal, and the
backslash allowed me to do that. Would you provide me with the options
that are available when using search? Yes, I forgot to mention that
that's the name of the program. Search is a batch file found in /Perl/
bin, but I can't find instruction for it with perldoc.

Also, would you provide more informatino on how I would use an HTML
parser to search only the text instead of the HTML? Thanks.


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 1653
***************************************


home help back first fref pref prev next nref lref last post