I am writing a script on my personal machine which is connected to the remote server. I think the remote server has Perl 4.0 or lesser version installed and that is why it is unable to recognize the same. Is there an alternative to the chomp
command?
It's not an exact replacement, but you could try:
$var =~ s/\r?\n?$//
which will strip either CRLF (DOS), LF (Unix), CR (Mac?).
The normal chomp operator always strips out the currently defined $INPUT_RECORD_SEPARATOR
for the current O/S.