#!/usr/bin/perl -w use strict; use Net::SSH::Expect; use Data::Dumper; my ($host,$user,$password) = ('172',"abc","xyz",); my $ssh = Net::SSH::Expect->new( 'host'=>$host, 'user'=>$user, 'password'=>$password, 'timeout' => 20 ); my $login_output = $ssh->login(); my $file = "/foo/boo"; $ssh->send("cat $file"); while (my $line = $ssh->read_line()) { print "Doing operation on $line\n"; }