Hi,

I have the below lines of code.

#!/usr/bin/perl
use strict;
use warnings;

my $text =" a line of text\n" ;
chomp($text); #the chomp operator gets rid of the newline character
print "$text";

My question is if i remove the new line character "\n" in the above code
then i dont need the chomp operator if my understanding is correct.

so where does the chomp operator plays its role, can some one explain me
here with a sample of code.

Thanks and Regards

Kaushal

Reply via email to