On Wednesday, May 1, 2002, at 06:47 , John W. Krahn wrote:
> Jaimee Spencer wrote: [..] >> >> I know I am missing something basic here also, but tell me in the >> example >> (my $projectId) = $projectDocDir =~ m!.*/(\w+)/!; >> why isn't the /1_0001.doc being printed as well? > > Because the (\w+) has to have a slash '/' in front of and behind it. > /1_0001.doc doesn't have a slash at the end. which of course explains why it would be able to match any of the 'directory' names down the chain, but not quite why it matches ONLY the last in the lot.... OYE! now I get it...... $doc =~ m!(.*)/(\w+)/!; print "one is :$1: undt two is :$2:\n"; puts all of the stuff above 19463 into the (.*) {matchall} bit... Whereas the scalar context walk of the form: while($doc =~ m!/(\w+)!g) { print "match is: $1 \n"; } would hand out each in turn.... ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]