Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: if statement

by IndyZ (Friar)
on May 08, 2002 at 05:09 UTC ( #164912=note: print w/replies, xml ) Need Help??


in reply to if statement

From the level of code you presented here, I would recommend a book like "Learning Perl" from O'Reilly. It will cover much of the general programming experience that you seem to be lacking as well as all of the other concepts that you need to complete this task.

What follows are a few of the errors in your code.

  • Why are you opening "Bad"? You never write to it.
  • The while-loop will run forever. - see tachyon's reply.
  • "Classified == unclassified" won't work since you are comparing a filehandle to something that doesn't exist.
  • "print FH Good\n;" - You never opened the filehandle FH.
  • Make sure you close() any files you open

update: Moved recommendations to the top.

--
IndyZ

Replies are listed 'Best First'.
Re: Re: if statement
by tachyon (Chancellor) on May 08, 2002 at 05:48 UTC

    The while-loop will run forever

    Actually this is a very common idiom for reading a file a line at a time.

    while(<DATA>) { print; } __DATA__ The while loop will finish now!

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

      Whoops. I was looking at a copy that I had pasted into my node, sans <code> tags so it disappeared on me.

      --
      IndyZ

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://164912]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2022-08-08 04:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?