chomp operator
- From: kaushalshriyan@xxxxxxxxx (Kaushal Shriyan)
- Date: Tue, 30 Oct 2007 20:00:52 +0530
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
- Follow-Ups:
- RE: chomp operator
- From: Richard Fernandez
- Re: chomp operator
- From: Yitzle
- Re: chomp operator
- From: Rob Coops
- RE: chomp operator
- Prev by Date: RE: Hash Variables
- Next by Date: Pragmas use strict and use warnings
- Previous by thread: Perl 5.8.6 bug in open()?
- Next by thread: Re: chomp operator
- Index(es):