Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: exit the loop corrected

by lemming (Priest)
on Jul 10, 2002 at 22:12 UTC ( #180889=note: print w/replies, xml ) Need Help??

in reply to exit the loop corrected

while ( $theSubBuild ne 'sci.bld' || 'esel.bld')
is equivalent to
while ( $x ne 'ya' || 1 )

I assume you meant for the loop to stop if $theSubBuild is equal to either of your strings. What Perl is doing is seeing if either of the expressions on both sides of the || are true. 'esel.bld' will always be true.

What you probably want is:
while ( $theSubBuild ne 'sci.bld' && $theSubBuild ne 'esel.bld')

Update: Fixed a bit of spelling and added comments since I was editing anyways.

I'm uneasy about the grep system call into a file and then reopening the file. I'd rather just read from a pipe if I was going to use the system grep through a bunch of files.

I tend to just read the files and get my info that way and leave the OS out of it.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://180889]
[marto]: and I'm off next week1
[Corion]: Whee! ;)
[Corion]: I was away last week already, so I know how good a week off is ;))
[Discipulus]: a barter with your time (above the poorline time is always better than money)

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2017-02-28 10:16 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (399 votes). Check out past polls.