Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Variable/if question...

by Indomitus (Scribe)
on Nov 04, 2001 at 12:17 UTC ( [id://123152]=note: print w/replies, xml ) Need Help??


in reply to Variable/if question...

You should have a <FILE> in the while() loop. The <FILE> tells perl to loop through your file one line at a time. You can also read the whole file into memory by doing @lines = <FILE> but it's up to you if you want to use that memory.
if($pword==$cpword){ open (FILE, "memberlist.txt"); while(<FILE>){ push @lines,$_; close FILE; } }
UPDATE: You might also want to try checking your open statement to make sure it worked.
open (FILE, "memberlist.txt") || die "Cannot open: $!";
The $! gives you the error message from the open command if it failed.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-09-12 03:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The PerlMonks site front end has:





    Results (15 votes). Check out past polls.

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.