Path: utzoo!attcan!uunet!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!mips!prls!pyramid!unify!csusac!ucdavis!sunny!poage From: poage@sunny.ucdavis.edu (Tom Poage) Newsgroups: comp.lang.perl Subject: "Out of memory!"? Message-ID: <482@sunny.ucdavis.edu> Date: 13 Jul 90 20:06:01 GMT Reply-To: poage@sunny.ucdavis.edu (Tom Poage) Organization: UCDMC Clinical Engineering, Sacto., CA Lines: 55 I'm tinkering with redirecting stdout and stderr to files and then looking at the results. However, one variant gives me "Out of memory!" (Sun 3/150, 4.0.3). #START open(SAVEOUT, ">&STDOUT"); # Save file descriptors. open(SAVEERR, ">&STDERR"); open(STDOUT, ">$OFILE"); # Output file. open(STDERR, "+>$EFILE"); # Error file. #system('/bin/MyProgram', @COMMANDS); print STDERR "multiple\nline\nSQL:\nstuff\n"; #DEBUG:simulate error. close(STDOUT); open(STDOUT, ">&SAVEOUT"); #close(STDERR); #open(STDERR, ">&SAVEERR"); open(PRGOUT, $OFILE); # Let's look at the output. #open(EFILE, $EFILE); # Let's look for errors. seek(STDERR, 0, 0); # We'll just rewind the error file instead. if (@errs = grep( do{/^SQL:/ ? undef : s/^/\t/o;}, )) { print "Error message(s):\n", @errs; #DEBUG } else { print while ; #DEBUG } #END Now, what I want to do is grub through what was produced to stderr, remove purely informational stuff (/^SQL/) and prepend a tab to all the real errors (a format, sorta). This works properly if (@errs = grep(s/^/\t/, grep(!/^SQL:/, ))) { .... So does this @messages = ; if (@errs = grep( do{/^SQL:/ ? undef : s/^/\t/o;}, @messages)) { .... But this if (@errs = grep( do{/^SQL:/ ? undef : s/^/\t/o;}, )) { .... produces "Out of memory!". Did I do something to deserve this? Anyone care to comment? Tom. -- Tom Poage, Clinical Engineering Universiy of California, Davis, Medical Center, Sacramento, CA poage@sunny.ucdavis.edu {...,ucbvax,uunet}!ucdavis!sunny!poage