use strict; use warnings; use Data::Dumper; use feature 'say'; no warnings 'uninitialized'; use IPC::Open3; print 'Login: '; chomp (my $login = <>); print 'Password: '; chomp (my $password = <>); print 'Fichier IP: '; chomp (my $SOURCE = <>); print 'Fichier ligne de commandes:'; chomp (my $commande = <>); my $cmd = 'ssh -o StrictHostKeyChecking=no -o ConnectTimeout=3 -l'; my $pid = open3(\*WRITER, \*READER, \*ERROR, $cmd); #if \*ERROR is 0, stderr goes to stdout while( my $output = ) { print "output->$output"; if ($output =~ /username/i) { print WRITER "nsoc-iec\n"; } }