On Sun, Aug 29, 2010 at 09:23, Kaushal Shriyan <kaushalshri...@gmail.com> wrote: > On Sun, Aug 29, 2010 at 6:11 PM, Chas. Owens <chas.ow...@gmail.com> wrote: >> On Sun, Aug 29, 2010 at 07:15, Kaushal Shriyan <kaushalshri...@gmail.com> >> wrote: >>> Hi >>> >>> Can someone please explain me with an example of the usage chomp () >>> builtin function in perl. >> snip >> >> The chomp function removes whatever is in the $/ variable from the >> argument passed in (or $_ if no argument is passed in). The default >> value of $/ is "\n". It is often used after reading a line to remove >> the newline ("\n"): >> > > Hi Chas > > $/ variable is a line separator variable whereas $_ is a default > variable. Please explain me when you said no argument is passed > so what i understand is chomp $line means $line is a argument ? > > Thanks > > Kaushal >
Yes, $line is an argument that is passed to chomp in the code I sent earlier. When you say chomp $line; then the $line variable will be affected, but if you say chomp; then the $_ variable will be affected. -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/