in reply to How to eliminate white spaces,tabs,new lines at thestart and end of a long string ??
use strict; my $str = "\n Sugarkannan is a smart guy \n"; $str =~ s/^\s*(.*?)\s*$/$1/; print ">$str<\n";
Prints:
>Sugarkannan is a smart guy<
Update: s/printf/print/
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to eliminate white spaces,tabs,new lines at thestart and end of a long string ??
by friedo (Prior) on Nov 24, 2005 at 07:38 UTC | |
by GrandFather (Saint) on Nov 24, 2005 at 09:59 UTC |