Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

RE: Re: Can't open file within subroutine

by muppetBoy (Pilgrim)
on Jun 14, 2000 at 18:33 UTC ( [id://18106]=note: print w/replies, xml ) Need Help??


in reply to Re: Can't open file within subroutine
in thread Can't open file within subroutine

Try replacing
open(INFO, <"/export/home/cad/data/products/$name/source/$name.bom">)
with
open(INFO, "/export/home/cad/data/products/$name/source/$name.bom")
This should work if you want to just read from INFO.
You are still not actually doing anything with the contents of the file. Try using:
@lines = <INFO>; close (INFO);
this will read all of the file into the lines array and then close the file (which is always good practice)
Also, in your open or die code you may want to use $! as that will contain the relevent error message.
Incidently try to wrap any code you post in the code tags, see Site How To, because it make it much easier to read.

Log In?
Username:
Password:

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

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










    Results (65 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.