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: Missile Defense and Afghanistan
    ... Couldn't swear to it, mind you. ... That was then, though, and as the saying goes, this is now. ... Western Civilization in Afghanistan? ... some pretty dodgy Italian partisans was hanged by the German Army. ...
    (sci.military.naval)
  • 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: 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: 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)