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

Re: Can't open file within subroutine

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


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
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2025-03-26 23:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When you first encountered Perl, which feature amazed you the most?










    Results (68 votes). Check out past polls.

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.