in reply to Re: opening a file passed into sub as ref
in thread opening a file passed into sub as ref
sub _ce { print "IN CE SUB\n"; die "no parameter!\n" unless @_; my ($ce_ref) = @_; for my $name (@{ $ce_ref }) { @asof = +(split("/", $name, 0))[-3,-2,-4]; $lpname = +(split("/", $name, 0))[3]; print $csv "$lpname\n"; print $csv '*' x length($lpname),"\n"; print '*' x length($lpname),"\n"; print "$name\n"; open (my $i, "+<", $name) or warn $!; ### FAILS HERE ### while (<$i>) { chomp $i; next if $i =~ /$regexp_2_skip/; next if $i !~ /$regexp_2_get/; ($i) =~ s/:/,/g; ($i) =~ s/\s+//g; print $csv "$i,\n"; print "$i,\n"; } } print $csv "\n\nHost,Entitled CPU and RAM as of @asof,\n\n"; return; } __OUT__ SCALAR NPLPARS 30 SCALAR lparstat: 30 IN CE SUB ******** /opt/r2configs/edidev00/2018/03/13/lparstat-i.out No such file or directory at get_nonprod_AIX_resrcs_used.plx line 454, + <$lus> line 131. readline() on closed filehandle $i at get_nonprod_AIX_resrcs_used.plx +line 455. ********** /opt/r2configs/ediperqa00/2018/03/13/lparstat-i.out # ls -l /opt/r2configs/ediperqa00/2018/03/13/lparstat-i.out -rw-r--r-- 1 root system 2219 Mar 13 21:00 /opt/r2confi +gs/ediperqa00/2018/03/13/lparstat-i.out
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: opening a file passed into sub as ref
by poj (Abbot) on Mar 15, 2018 at 19:02 UTC |