> Hi, > Hello,
> so where does the chomp operator plays its role, can some one > explain me here with a sample of code. > > Thanks and Regards > > Kaushal > One place where chomp() comes in handy is when you're reading from a file. Usually a line read from a file will have a newline at the end. The terminating new line may get in the way of your processing, here's a contrived example: my $foo = 'some text to append to line\n'; open my $TESTFILE, '<', '/some/test/file') or die; while ( defined (my $line = <TESTFILE>) ) { # $line contains 'Some arbitrary text \n' print $line, $foo; } Without a 'chomp $line' the program will print: Some arbitrary text some text to append to line Instead of: Some arbitrary text some text to append to line as was probably intended. HTH richf -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/