I think the line you're looking for is 

   ($mytext) = $_ =~ /DisplayName(.*)/;

Perl assigns the default variable $_ to the result of a line read from a
file in a while(<FILEHANDLE>) statement.

-----Original Message-----
From: Allison Ogle [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 11, 2002 11:29 AM
To: [EMAIL PROTECTED]
Subject: Assigning part of a string to a variable using the filehandle.


Hi,

I have a problem trying to assign part of a string to a variable using the
filehandle.  For example, if the string was DisplayName  =XYZ and I want to
assign XYZ to the variable $mytext in the code below how would I do this.  I
am having trouble with the line ($mytext) =(<DATA>)=~ /DisplayName(.*)/; and
I know this is wrong but I can't find any documentation anywhere on how to
do this.  Any help would be great!

while(<DATA>){
        print if/DisplayName/;          # prints the line if it conains
'DisplayName'
        if(/DisplayName/){
                ($mytext) =(<DATA>)=~ /DisplayName(.*)/;
                print $mytext;
        }


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------------------
This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to