Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Re: Re: Re: remove both leading and trailing spaces

by the_0ne (Pilgrim)
on Sep 26, 2003 at 20:46 UTC ( #294540=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Re: remove both leading and trailing spaces
in thread remove both leading and trailing spaces

One thing you want to watch with regex2...
regex2 => sub { my $tmp = $val; $val = join (" ",split " ",$val); },
... is if the variable has spaces contained in the phrase that you want to keep, this will get rid of them...
$var = " Smart Way "; $val = join (" ",split " ",$val); print "var: $var\n"; # $var now "Smart Way", internal spaces gone.
regex1 and regex2 would retain the internal spaces.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://294540]
erix's head is getting content indisposed
[holli]: maybe try a GET instead?
[moritz]: I must say, when I was very active on perlmonks, I got really used to the markup and all the workflows
[moritz]: and then I didn't post for a while, and then tried to answer a question. It nearly drove me nuts
[moritz]: when you try to quote part of a question, you have to know/guess/reverse -engineer what kind of markup they used
[holli]: see? a/XpF4b
[moritz]: and stuff it into a <blockquote>...</ blockquote>, which is, like, not at all bulky
[moritz]: specially if you're used to markdown
[holli]: there probably is some nodelet hack that lets you use markdown :)
[LanX]: a) well ... you can use the xml-version to get the original code w/o need of reverse engineering

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (10)
As of 2017-11-20 19:19 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (291 votes). Check out past polls.