in reply to Redirect a substring/desired values from a System output to a file in Perl

But how can i redirect only those values to the output file??

Your scalar variable $output is just like any other variable. You can manipulate and modify it in any way you choose before printing it to the output file. If this actual modification is the part you are having trouble with, then for now ignore performing input and output and just work on that. Post an SSCCE if you still have trouble and maybe take a read through How to ask better questions using Test::More and sample data to help others understand what it is you want to achieve. eg:

use strict; use warnings; use Test::More tests => 1; my $have = '_id:ci2784'; my $want = 'ci2784'; # ... some code here which modifies $have is ($have, $want);

Good luck!