On Apr 10, 2011 5:54 AM, "John W. Krahn" <jwkr...@shaw.ca> wrote:
>
> shawn wilson wrote:
>>
>>
>> heh, i've got to learn to test my code before posting - i'm ending
>> looking like an idiot :)
>> *sigh* this is what i wanted to say:
>>
>>
>> #!/usr/bin/perl
>>
>> use warnings;
>> use strict;
>>
>> my $fields1 = "a little sentense with one and it will match with two\n";
>> my $fields2 = "this one will not match\n";
>>
>> work( $fields1 );
>> work( $fields2 );
>>
>> sub work {
>>    my( $fields ) = @_;
>>
>>    my @match = ( qr/one/i, qr/two/i, qr/etc/i );
>>    my @words = split /\W+/, $fields;
>
>
> Using \W means that numerical digits and the underscore character are part
of your "word" character set.  Is that what you really want?
>
>
That is what *I* would have expected. However, I seldom use those shorthand
matches in my code as some regex systems don't have them (mysql comes to
mind) and I find it clearer this way.

... so, I don't really have a good reason for posting it that way. Except
maybe I started with something similar that didn't work and wanted the same
type of thing that would work.

Reply via email to