in reply to removing the white spaces

Here's an idiomatic way,

my $text = ' The perl '; $text = join ' ', split ' ', $text;
That problem is called "normalizing whitespace". This solution depends on the whitespace-devouring nature of magical split.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^2: removing the white spaces
by ikegami (Patriarch) on Apr 13, 2006 at 20:52 UTC

    If you view the OP's HTML source, you'll see he actually asked:

    i should get output as "The   perl"

    and not

    i should get output as "The perl"

    Your solution doesn't answer his question (although that's not your fault).