in reply to String Matching

Abigail-II beat me to the punch, but here is a slightly different way for variety:
use strict; my @thing; # open up the DATA filehandle and loop one line at a time while (<DATA>) { # look for first \ and capture everything until the next \ into $1 # discard everything (.*) but don't be greedy (?) # capture any alphanumeric (\w) that is followed by .cxx into $2 if (/\\([^\\]+).*?(\w+\.cxx)/) { # store $1 and $2 into a datastructure push @thing, [$1,$2]; } } for (@thing) { my ($dir,$file) = @$_; print "$dir\t$file\n"; } __DATA__ qzang.5 \nbsstools\i95\src\i95val.h@@\main\golden\2 \nbsstools\i95\src\i95val.cxx@@\main\golden\2 \nbsstools\rlp\src\rlpval.cxx@@\main\golden\3 \nbsstools\rlp\src\rlpval.h@@\main\golden\3 source file(s) -- 4 rajeevv.19 \nbsscallpmsg\acl\src@@\main\golden\4 \nbsscallpmsg\acl\src\aclpi.h@@\main\golden\1 \nbsscallpmsg\acl\src\aclpi.cxx@@\main\golden\1 \nbsssbs\appl\src@@\main\golden\4 \nbsssbs\appl\src\radiomeasurements.h@@\main\golden\1

UPDATE per your reply:
This regex works for the data you provided.

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re: (jeffa) Re: String Matching
by Sara (Acolyte) on Jul 05, 2002 at 18:41 UTC
    if(/\\(^\\+).*?(\w+\.cxx)/) I get this error Use of uninitialized value in pattern match (m//) at dirFileSplit.pl line 13.