On Mon, 29 Jul 2002, David Samuelsson (PAC) wrote: > I get some output in the COMMAND filehandle, as you see i try to dont show it by >hiding it into an $output , then while the COMMAND is running i want perl to >interactivly examine the $output and seach for 10% if its there is should only print >that to the screen. now it still prints all the $_ to the screen..how do i fix this? > > @vobs = `dir /b $backupdir`; > chomp @vobs; > foreach $vob (@vobs) > { > open(COMMAND, `$dbcheck -a -k -r10 -p8192 $backupdir\\$vob\\db\\vob_db`);
You don't need backticks here, just a open(COMMAND, '$dbcheck .....|') or die "..." would do. perldoc -f open > while (<COMMAND>) > { > $output = $_; > if ($output =~ /.10\%./) > { > print "found 10\%"; > } By default the regex engine tests the match with the content of $_. You can leave out the $output = $_ assignment. This can be written as while (<COMMAND>) { if (/10%/) { print "found 10%"; } } '%' need not be escaped > } > } > > > thx for help > > //Dave > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]