All, never mind about responding to the past email, I got it ! My syntax was :
foreach (split /\n/, $EDM_nonactive_tapelist ) { #print OUT "$_\n" unless substr($_, 0, 5) eq '*Orig'; if ( /\((E\d+)/ ) { local $, = "\t"; print OUT "$1\n" unless substr($_, 0, 5) eq '*Orig'; } } close (OUT); Derek B. Smith OhioHealth IT UNIX / TSM / EDM Teams ----- Forwarded by Derek Smith/Staff/OhioHealth on 08/24/2004 03:56 PM ----- Derek Smith 08/24/2004 12:42 PM To: [EMAIL PROTECTED] cc: Subject: filehandle errors All, I am a little confused on how some of my code is compiling. This maybe a little long but basically my goal is: EDM Vault Tape List for client edm01 08/24/04 11:31 E01265 E00869 E00258 E00706 E00702 and I am attaining this, but not through the main program rather through a separate .pl file that has one subroutine. I had been trying to get the above this in one full swoop, but kept getting read/write IO errors stating FILEHANDLE only opened for writing so I changed the file to +<filename and after this I was not getting the above instead I was getting junk data. My goal is as above but through the MAIN programs block, so I attempted to use a while (<OUT>) outside of the foreach statement as highlighted in main instead of having this separate pl file produce the above results for me. sub LVIMAGE_FE { open (OUT, ">$lvimgFEtapes") || die "could not open file:$!"; my $lvimgFE_nonactive_tapelist = `ebreport media -template $FEsched`; select( (select(OUT), $|=1 ) [0] ); foreach (split /\n/, $lvimgFE_nonactive_tapelist ) { print OUT "$_\n" unless substr($_, 0, 5) eq '*Orig'; } close (OUT); } while (<OUT>) { if ( /\((E\d+)/ ) { local $, = "\t"; print OUT "$1 \n"; } } close (OUT); &LVIMAGE_FE; derek