while (defined ( my $line = <$sock> ) ){ chomp($line);# = $_); $line =~ s/(\x0a|\x0d)//g; # Display response from server # RUN THAT LINE BELOW INSTEAD OF USING SUB $scrolledText -> insert('end',"<< $line"); #&show($line); print "<< $line\n";