'ls' question, splitting and files with spaces in their name...

Rick Delaney rick-h4KjNK7Mzas at public.gmane.org
Sat May 22 21:48:21 UTC 2004


On Sat, May 22, 2004 at 10:30:16AM -0400, Madison Kelly wrote:
> 
>   By the way, Jim also recommended 'chomp' over substitue. May I ask 
> (both of your) reasoning on this? Being a new perl programmer I am very 
> open to tips and suggestions. Thanks!!

It's just semantics.  When reading line-by-line

     chomp; # remove the record separator if there is one

and 

     s/\n//;# remove the first newline character you find

will do the same thing but the meaning of the former seems to match the
intention of the code better.

You are right to avoid chop, which says "remove the last character".
This is certainly not what you mean and will cause you problems when the
last character is not newline.

-- 
Rick Delaney
rick-h4KjNK7Mzas at public.gmane.org
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list