http://www.perlmonks.org?node_id=18110


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

I'm not really sure what you are trying to do but here's a guess:
#!/usr/bin/perl opendir(DIR, '/export/home/cad/data/products') || die "Can't opendir D +ir: $!"; my @Dirs = grep { /^[^.].*/ && -d "/export/home/cad/data/products/$_" +} readdir(DIR); closedir DIR; foreach $name (@Dirs) { open(FILE,"</export/home/cad/data/products/$name/source/$name.bom" +) || die "Can't open $file: $!"; my @lines=<FILE>; close(FILE); foreach $line (@lines) { $line=~ s/BOARDPLACEMENT_BOM brd//; print "\n $line "; print "\n------------------------ \n"; } };
The thing I can't really figure out is why anyone would like to do that.

/brother t0mas