Re: Searching in a line



lerameur wrote:
On Aug 30, 4:57 pm, "Jürgen Exner" <jurge...@xxxxxxxxxxx> wrote:
lerameur wrote:
On Aug 30, 4:39 pm, "Jürgen Exner" <jurge...@xxxxxxxxxxx> wrote:
lerameur wrote:
while ($data=<$fh>) {

Here you are reading each line into $data

if (/beth/) { #matches only if beth is in line

and here you are matching /beth/ against the default $_.

No. I am saying you should make up your mind if you want to use the
default $_ or your own $data. Either is ok, but not both.

I do not make difference between the two. This is new to me.

Oh come on! Do you really expect if you are setting one variable named $data
another totally unrelated variable named $_ would magically assume the same
value? How long have you been programming?

I guess I will sue the default one.

Ok, then don't assign the read line to $data:

while (<$fh>) {

jue


.



Relevant Pages

  • Re: A simple question?
    ... 'S' is implicity bound by a universal quantifier. ... How is it different from saying "G is an abelian group"? ... but that is not what we have in mind). ... And as the Dictator, also I should be free to take "S can be well ...
    (sci.math)
  • Re: "K"
    ... "Kay", but spelled only with the letter of that name). ... If you are saying it often, ... I know that I tend to rehearse spellings as I say ... name in the forefront of your mind, preventing you from feeling at ease ...
    (alt.usage.english)
  • Re: Stopped smoking
    ... but don't fool yourself into saying it is easy. ... I've got nothing to do I 'notice' that I'm not smoking. ... Provided you can get your mind away from the "notice" stage each time it ... Ooh new bike time! ...
    (uk.rec.motorcycles)
  • Re: mainstream science getting round to the creationist view of things
    ... to be actualized amongst the multiple potential states is independent ... program, which give rise to the mind, what I called a computing memory. ... predictability then other scientists are talking about. ... The other scientists are saying ...
    (talk.origins)
  • Re: Who Sez Secrets Cannot be Kept?
    ... wrongdoing much less Probable Cause... ... We set up the laws to ban *FOR LIFE* any driver caught impaired from being behind the wheel of anything other than a lawn tractor, and I might fall into your category.. ... and, frankly, this is one area I don't mind my personal rights taking second place to public safety.. ... Not saying you're wrong.. ...
    (rec.martial-arts)