#!/usr/bin/perl $| = 1; open($handle, "| openssl s_client -connect 1.1.1.90:443 -quiet"); open(file,"<","1.txt"); while (){ print $handle $_,"\r\n";} close file; open(file,"<","2.txt"); while (){ print $handle $_,"\r\n";} close file; open(file,"<","3.txt"); while (){ print $handle $_,"\r\n";} close file; close $handle