Re: Extrating String using Split
- From: xhoster@xxxxxxxxx
- Date: 21 Nov 2005 18:25:52 GMT
"Ashwin" <Ashwin@DoNot@Email.com> wrote:
> Hi All
> I have following code,
>
> my $Loc="C:\\Temp\\testing_disp\\Internal";
> my
> @alldir=("C:\\Temp\\testing_disp\\Internal\\A","C:\\Temp\\testing_disp\\
> Internal\\B","C:\\Temp\\testing_disp\\Internal\\C");
>
> where A,B,C are deeper directory tree what I need, is to split so that
> I get directory tree A,
>
> The problem if I use below code it complains
> my @finaldir=map((split(/$Loc/))[1],@alldir);
> Unrecognized escape \T passed through before HERE mark in regex m/C:\T
> << HERE emp\testing_disp\Internal/
>
> even
> @finaldir=map(/$Loc(.*)/,@alldir);
> fails with the same error
> even if I remove reference to "c:" I still cannot split
Read about \Q in perldoc perlretut.
>
> Question is how to extract rest of tree;
something like: /\Q$Loc\E(.*)/
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
.
- References:
- Extrating String using Split
- From: Ashwin
- Extrating String using Split
- Prev by Date: char->integer, integer->char commands
- Next by Date: Re: char->integer, integer->char commands
- Previous by thread: Re: Extrating String using Split
- Next by thread: Trouble in wantarray context
- Index(es):