thendal
Programmer
- Aug 23, 2000
- 284
Hi all!
I am trying to delete leading and trailing spaces from a string . I used the following substution .
$t=" test test ";
$t=~s/^\s+//;
$t=~s/\s$+//;
print $t;
It works fine . when i try to make replacement in one line code
say
$t=~s/^\s+|\s$+//;
it just replaces leading space not trailing space ..what am i doing wrong.
~Thendal
Morpheus: Have you ever had a dream, Neo, that you were so sure was real? What if you were unable to wake from that dream? How would you know the difference between the dream world and the real world?
I am trying to delete leading and trailing spaces from a string . I used the following substution .
$t=" test test ";
$t=~s/^\s+//;
$t=~s/\s$+//;
print $t;
It works fine . when i try to make replacement in one line code
say
$t=~s/^\s+|\s$+//;
it just replaces leading space not trailing space ..what am i doing wrong.
~Thendal
Morpheus: Have you ever had a dream, Neo, that you were so sure was real? What if you were unable to wake from that dream? How would you know the difference between the dream world and the real world?