RE: chomp operator

2007-10-30 Thread RICHARD FERNANDEZ
> 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

Re: chomp operator

2007-10-30 Thread yitzle
I find chomp() usefull for processing a file, or other input (eg keyboard). #!/usr/bin/perl use strict; use warnings; while(<>) { print "$_"; # $_ has a newline attached, either from file or STDIN chmop; doSomethingWithTheString($_); } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For addi

Re: chomp operator

2007-10-30 Thread Rob Coops
Hi Kaushal, Yes you are right if you have a hardcoded line of text in your script you know if there is a "\n" or not at the end. Now imagine you are reading a bunch of data from a text file created from user input or some unknown script... who knows how much weird things are there at the end of t