E
EFP
Can anyone help me with a simple regular expression problem.
All that I want to do is take a list of known data and extract a
particular section of the string to form a new list.
Here is my code snipet:
my $fh = new FileHandle('c:\Units.txt') ; ## sucks up my work file
my @lines1 = <$fh>; ## assigns the filehandler contents to @lines1
foreach $string (@lines1) ## extract each line from @lines and put it
in $string
{
$string =~ m/\*@@\$/;
print "NewString :: $string\n";
}
Sample Units.txt data:
..\Source\CPP\ConnPool\src\oraUtils.pc@@
..\Source\CPP\ConnPool\src\sample.pc@@
..\Source\CPP\Services\src\OExceptServer.pc@@
..\Source\CPP\Services\src\Rees1440Server.pc@@
..\Source\CPP\Services\src\SWDTestServer.pc@@
..\Source\CPP\TestCases\TestRees1800\testRees1800Cursor.pc@@
..\Source\CPP\TSRI\Remis1\cxxsrc\Buffer_Area.pc@@
I just want the:
oraUtils.pc
I'd even settle for:
oraUtils.pc@@
So basically I want the contents between "\" and the "@@"
I thought that:
$string =~ m/\*@@\$/;
Would go to the end of the search line and find "@@" and get anything
"*" between the "@@" and the "\" and set $string to this new value.
What it returns is:
element:: .\Source\CPP\ConnPool\src\oraUtils.pc@@
Can anyone correct my understanding of regular expression and
assignment to a varibale.
Thanks.
EFP
All that I want to do is take a list of known data and extract a
particular section of the string to form a new list.
Here is my code snipet:
my $fh = new FileHandle('c:\Units.txt') ; ## sucks up my work file
my @lines1 = <$fh>; ## assigns the filehandler contents to @lines1
foreach $string (@lines1) ## extract each line from @lines and put it
in $string
{
$string =~ m/\*@@\$/;
print "NewString :: $string\n";
}
Sample Units.txt data:
..\Source\CPP\ConnPool\src\oraUtils.pc@@
..\Source\CPP\ConnPool\src\sample.pc@@
..\Source\CPP\Services\src\OExceptServer.pc@@
..\Source\CPP\Services\src\Rees1440Server.pc@@
..\Source\CPP\Services\src\SWDTestServer.pc@@
..\Source\CPP\TestCases\TestRees1800\testRees1800Cursor.pc@@
..\Source\CPP\TSRI\Remis1\cxxsrc\Buffer_Area.pc@@
I just want the:
oraUtils.pc
I'd even settle for:
oraUtils.pc@@
So basically I want the contents between "\" and the "@@"
I thought that:
$string =~ m/\*@@\$/;
Would go to the end of the search line and find "@@" and get anything
"*" between the "@@" and the "\" and set $string to this new value.
What it returns is:
element:: .\Source\CPP\ConnPool\src\oraUtils.pc@@
Can anyone correct my understanding of regular expression and
assignment to a varibale.
Thanks.
EFP