[EMAIL PROTECTED] [[EMAIL PROTECTED]] quoth:
*>
*>$string =~ s/^\s+//; Removes leading whitespaces
*>
*>$string =~ s/^\s+//g; /g (GLOBALLY) is redundant in the
*>case of "leading whitespages"
For a beginner, it's a not a critical detail.
e.
--
To unsubscribe,
> If I have a string and the first character is a space,
> may not always be a space.
> Example: John
> Tommy
> Beth
>
> John and Beth have a space, Tommy does not.
> How do I strip that. I do not want to use the global
> command because a want the space between Fir
$string =~ s/^\s+//; Removes leading whitespaces
$string =~ s/^\s+//g; /g (GLOBALLY) is redundant in the
case of "leading whitespages"
See PERL Cookbook page 30 for the answer to your question.
__
William Ampeh (x3939)
Federal Reserve Board
Tanton Gibbs [[EMAIL PROTECTED]] quoth:
*>
*>The regular expression
*>s/^\s//;
s/^\s+//g; would be even better as it would remove all whitspace at the
beginning of a line and it would replace all matches to the pattern
instead of just the first it finds.
e.
--
To unsubscribe, e-mail: [EMAIL P
the beginning of the string
\s # one space character ( space, tab, or newline )
/ # and replace it with
/ #nothing
;
- Original Message -
From: "Susan Aurand" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 01, 2002 1:08
If I have a string and the first character is a space,
may not always be a space.
Example: John
Tommy
Beth
John and Beth have a space, Tommy does not.
How do I strip that. I do not want to use the global
command because a want the space between First
and Last name.