Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple Pattern Matching Qusetion

Status
Not open for further replies.

DANZIG

Technical User
Mar 8, 2001
142
US
Hello all,

I'm new to perl but have read the faq.
I'm trying to create an arry from a file that contains in formation with in quotes. I would like to pull the "information" in to the arry and disregard the rest, not sure as to the best way to do this though.This is what I have so far but not getting the logic right yet.

START CODE:


$MEMBERS = "c:\\working\\post.txt";
open MEMBERS, $MEMBERS or die "Cannot open $MEMBERS for read :$!";

$membr = (<MEMBERS>,$_ );

while (<MEMBERS>) { if ($membr=~/&quot;/ ) @names=split /&quot;/, $membr print @names ;} else { print &quot; not a member \n&quot;;}
}



END CODE

Thanks :)
 
$MEMBERS = &quot;c:\\working\\post.txt&quot;;
open MEMBERS, $MEMBERS or die &quot;Cannot open $MEMBERS for read :$!&quot;;
while (<MEMBERS>)
{
if ($_=~/&quot;(.+)&quot;/ ){
push(@names, $1);
}
}
luciddream@subdimension.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top