Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
There's more than one way to do things
 
PerlMonks  

Re: Can't open file within subroutine

by jjhorner (Hermit)
on Jun 14, 2000 at 12:20 UTC ( [id://18078]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Can't open file within subroutine

In your code above, you are never getting a line.

Your code opens the file, but never draws data. Try something like this:

@lines = <INFO>;

Your code has other issues, such as:

  • Why do you call a subroutine first, but declare it inside your foreach loop? I wouldn't even use the subroutine structure. This is small enough that you probably shouldn't need it.
  • You don't want to have a "close" call inside a different loop than the "open" call. Will cause funny things, I believe.

I hope this helps.

J. J. Horner
Linux, Perl, Apache, Stronghold, Unix
jhorner@knoxlug.org http://www.knoxlug.org/

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://18078]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.