Re: deleting spaces

2002-10-15 Thread Janek Schleicher
Learn Perl wrote: > I have a simple question. > > Is there ways to get rid of any spaces within a variable? > > say the variable holds " R" or "R " or " R ". > is there a function I could use for that? > I tried chomp but it will only get rid of the last space but not the > leading spaces. You

Re: deleting spaces

2002-10-14 Thread John W. Krahn
Steve Grazzini wrote: > > There are several reasonable answers, and I'm not > sure which one you're looking for: > > 1) tr/ //d # remove all *spaces* 1.5) tr/ \n\r\t\f//d # remove all whitespace (quickly) > 2) s/\s+//g # remove all "whitespace" > > And check: > > $ perldoc -q

Re: deleting spaces

2002-10-14 Thread Steve Grazzini
Learn Perl <[EMAIL PROTECTED]> wrote: > > I have a simple question. > > Is there ways to get rid of any spaces within a variable? > > say the variable holds " R" or "R " or " R ". > is there a function I could use for that? > I tried chomp but it will only get rid of the last space but > not t

Re: deleting spaces

2002-10-14 Thread Wiggins d'Anconia
Welcome to the world of regular expressions perldoc perlretut - for lots of info for your problem: $variable =~ s/\s//g; http://danconia.org learn perl wrote: > Hi guys, > > I have a simple question. > > Is there ways to get rid of any spaces within a variable? > > say the variable h

RE: deleting spaces

2002-10-14 Thread Toby Stuart
OTECTED]] > Sent: Tuesday, October 15, 2002 9:38 AM > To: [EMAIL PROTECTED] > Subject: deleting spaces > > > Hi guys, > > I have a simple question. > > Is there ways to get rid of any spaces within a variable? > > say the variable holds " R" or

RE: deleting spaces

2002-10-14 Thread Beau E. Cox
Hi - Use this simple regex: $var =~ s/ //g; or if your variable is in $_, just s/ //g; Aloha => Beau. -Original Message- From: learn perl [mailto:[EMAIL PROTECTED]] Sent: Monday, October 14, 2002 1:38 PM To: [EMAIL PROTECTED] Subject: deleting spaces Hi guys, I have a sim

deleting spaces

2002-10-14 Thread learn perl
Hi guys, I have a simple question. Is there ways to get rid of any spaces within a variable? say the variable holds " R" or "R " or " R ". is there a function I could use for that? I tried chomp but it will only get rid of the last space but not the leading spaces. Thanks Eric -- To unsubs