my $foo = " \t\n\r hello, world!";
$foo =~ s/^\s+//; # This is the line that removes the leading whitespace.
print "$foo\n";
print ord($foo) . "\n";
Будет отображаться:
hello, world!
104
104 - код символа ASCII для h
, доказывающий, что строка не имеет начальных пробелов.