Lydia has asked for the wisdom of the Perl Monks concerning the following question:
I'm a complete Perl newbie here. I can't get this file at line8 to open within this subroutine. Any help would be greatly appreciated.
"#!/usr/bin/perl -w init_open(); opendir (EXA, "/export/home/cad/data/products") || die "no dir?: $1"; foreach $name(sort readdir (EXA)) { print "$name\n"; sub init_open { open(INFO, "/export/home/cad/data/products/$name/source/$name.bom") || + die "no dir: $1"; @lines = <INFO> ; } foreach $line (@lines) { $line=~tr/(//d; #Cut out all the exa garbage $line=~ s/COMP//; $line=~ s/BOARDPLACEMENT_BOM brd//; print "\n $line "; close(INFO) ; } print "\n ------------------------ \n"; } closedir(EXA);"
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Can't open file within subroutine
by jjhorner (Hermit) on Jun 14, 2000 at 16:20 UTC | |
RE: Can't open file within subroutine
by chromatic (Archbishop) on Jun 14, 2000 at 23:45 UTC | |
by jlp (Friar) on Jun 15, 2000 at 15:26 UTC | |
Re: Can't open file within subroutine
by Lydia (Initiate) on Jun 14, 2000 at 18:56 UTC | |
Re: Can't open file within subroutine
by Lydia (Initiate) on Jun 14, 2000 at 18:23 UTC | |
by muppetBoy (Pilgrim) on Jun 14, 2000 at 18:33 UTC | |
by t0mas (Priest) on Jun 14, 2000 at 18:48 UTC |
Back to
Seekers of Perl Wisdom