-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Tony Heal wrote: > Why doesn't this work? I want to take any leading or trailing white spaces > out. If I remove the remark it works, but I > do not understand why it requires the second line For reference, perldoc perlre and search for greedy.
Basically, the .* matches as much as possible, so it gets the spaces as well. To make it not greedy, you add a ?, so $string =~ s/^\s+(.*?)\s+$/$1/; would work. Hope this helps, Ricky -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFGskSdZBKKLMyvSE4RAmoLAJ9FPUqm+9utecURkec0gMWItfKEYACgmpeS lf1qanHZefDeV5z87LMusWo= =8U17 -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/