in reply to How to give input to terminal (command window) in perl

Hello and welcome to the monastery tsathish123

as said Expect (Edit: and Test::Expect too) can be an option. Wath you want is generally called IPC (Inter Process Communication) ad the Perl way is described in the language reference found here: perlipc

While two core modules can accomplish your task ( IPC::Open2 and IPC::Open3 which also manage STDERR ) on CPAN exist many other options, sometimes more viable like IPC::Run IPC::Run3 or if you just need to read from external program also Capture::Tiny

The old but always recomandable book Perl Cookbook contains a chapter, the 16th, dedicated to Process Management and Communication

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.