Hi Shaunn What exactly are you getting? because this looks like it should work, except that your value for $source doesn't match the directories listed in the results.
A couple of points though. This won't work in general, because if $source contains any special regex characters then it will behave accordingly instead of matching the literal text. And secondly, you don't need all that split() stuff. This will do foreach my $group ( `ls -d1 $source/0*/*` ) { ($bu, $pcgname) = ($group =~ m/\/(\d\d)\/(.*)/ ); } HTH, Rob ----- Original Message ----- From: "Johnson, Shaunn" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, December 10, 2002 6:43 PM Subject: parse out parts of dir / files / > Howdy: > > I'm having problems trying to parse out part > of a directory into variables. > > I start with this: > > [snip script] > > /usr/local/bin/perl -w > use diagnostics; > > my $dest="/i/'Depression Management'/Mailing/dec2002_iso_images"; > > # Where is data coming from? > my $source="/i/'Depression Management'/Mailing/Dec2002"; > > foreach $group ( split(/\n/,`ls -d1 $source/06/*`) ) { > print $group, "\n"; > } > > [/snip script] > > And this is the results: > > [snip results] > > /i/Local Test Dir/Mail/December2002/06/first workgroup (emi).pdf > /i/Local Test Dir/Mail/December2002/06/prof arrange (test).pdf > . . . > . . . > > [/snip results] > > > What I want is to parse out the path into 3 variables: > > [broken logic] > > foreach my $group ( split(/\n/,`ls -d1 $source/0*/*`) ) { > ($bu, $pcgname)=($group =~ m/$source\/(0\d)\/(.*)/i); > > [/broken logic] > > > How can I split $group in to $source, any number (06 in this example) > and any file name listed after that (which will most likely include > white spaces in the names)? In the above, I thought I was only > getting the digit and everything else into the TWO variables (but > I guess not) ... > > Thanks for any suggestions! > > -X > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]