in reply to Regular Expression

\w won't match ':', it will match only [0-9a-zA-Z_].

You try this

$_ = "package MyClass::Subclass::one; package Myclass::two;"; /^(\w+) ([\w:]+)\;/; print $2;

Also take a look at perlre.

Prasad