Re: Searching in a line



On Aug 30, 8:15 pm, "Jürgen Exner" <jurge...@xxxxxxxxxxx> wrote:
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?
Well, I just graduated from school so not that long, I mostly
programmed microcontrollers


I guess I will sue the default one.

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

while (<$fh>) {

Its working great now. thanks

.