in reply to Re: Returning and passing data to and from subroutines
in thread Returning and passing data to and from subroutines

Using xms switches and m{} instead of // with every regex is a suggestion by Damian Conway in his book 'Perl Best Practices'

So vendion really wanted to write

s{\A \s* }{}xms

UPDATE: Removed a \Z that shouldn't have been there

Replies are listed 'Best First'.
Re^3: Returning and passing data to and from subroutines
by almut (Canon) on Jul 07, 2010 at 23:59 UTC
    So vendion really wanted to write ...

    Well, just another speculation :)

    The OP said in the comment "...testing the input for valid alphanumeric characters".  What you're suggesting would remove all whitespace if there's nothing but whitespace in the string.

      Sorry, I added a \Z that wasn't in the source (so it just removes leading spaces). My point was about the style not the contents of the regex.
Re^3: Returning and passing data to and from subroutines
by vendion (Scribe) on Jul 13, 2010 at 15:33 UTC

    Yes I was trying to follow the suggestion in the 'Perl Best Practices' book, but what I was wanting to go for was removing the whitespace before and after any kind of text. Sorry for the confusion