Perhaps I'm missing something but I don't think that's going to work. Firstly, shouldn't the file read be outside the map? Seems to be a syntax error with it inside. Secondly, with the read in the right place all that gets passed to the print statement is the result of the chomp so you just pass a series of 1s to the socket. Thirdly, the lines passing through the map are not going to be interpreted as separate records so the lines will all get concatenated with a single "\r\n" at the end.
Perhaps something along these lines would be better? (I've used "XX" instead of "\r" for visibility).
use strict;
use warnings;
print map { chomp; qq{$_ XX\n} } <DATA>;
__END__
line 1
line 2
line 3
and the output
line 1 XX
line 2 XX
line 3 XX
If you do use English; it is a good idea to specify the -no_match_vars option to avoid a performance hit on all regexen in your script.
# Avoid performance hit on regexen by specifying
# -no_match_vars.
#
use English q{-no_match_vars};
I hope this is of interest.
Cheers, JohnGG |