Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Variable/if question...

by mkmcconn (Chaplain)
on Nov 04, 2001 at 12:24 UTC ( #123153=note: print w/replies, xml ) Need Help??


in reply to Variable/if question...

Indomitus beat me to the submit button, I see.

if($pword eq $cpword){ open (FILE, "< memberlist.txt") or die $!; while(<FILE>){ push @lines,$_; } close FILE or die $!; }
  • You'll be able to zero in on problems like this if you habitually use the die statement, to test whether you've had success.
  • Unless your passwords are numeric, you'll want to test equivalence with 'eq', unstead of '=='.
  • And finally - your code closed the filehandle inside of your while loop (another thing that die would have told you).

mkmcconn

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2023-03-22 09:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (60 votes). Check out past polls.

    Notices?