Hi Rob, At 18:44:10, on 11.25.03: Cracks in my tinfoil beanie allowed Rob Dixon to seep these bits into my brain:, > Deb wrote: > > > > What am I missing? > > Hi Deb. > > You're missing the hyphen from the character class. The \w class > is the same as [0-9A-Za-z_], and what you need is all of those > characters plus 'hyphen'. > > This seemed a good time to showcase the much-misunderstood and > underused qr// construct. If we do this: > > my $w = qr/[\w-]/;
Learned something new - I was not aware of the qr// construct... > > But I'm left wondering what you're trying to do with the lines. > > $name =~ /(\w*)\.*/; > $name =~ /(\w+)/; > > which I can't fathom. ;-) No doubt. My apologies for being sloppy. It was left over from a previous test and shouldn't have been included in the codelet of my first mesg. > HTH, Yes! Thanks for sharing a new way to do this. Very nice. deb > use strict; > use warnings; > > my $w = qr/[\w-]/; # Word characters plus hyphen > > my %name; > > while (my $name = <DATA>) { > $name =~ /($w*)/; > $name{$1}++; > print "$1\n"; > } > > __DATA__ > tibor.test.net > mars.test.net > moon-bx-r.test.net > moon-bs-d.test.net > moon-bt-321.test.net > > > **OUTPUT > > tibor > mars > moon-bx-r > moon-bs-d > moon-bt-321 -- o _ _ _ _o /\_ _ \\o (_)\__/o (_) _< \_ _>(_) (_)/<_ \_| \ _|/' \/ (_)>(_) (_) (_) (_) (_)' _\o_ http://zapatopi.net/afdb.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]