Click to See Complete Forum and Search --> : Help extracting values from variable


digital_storm
05-19-2005, 06:08 AM
Hello

I'm a newbie of Perl but I'm learning every day :-)

In my Perlprog I must search in different textfiles (T1 and T2) What I have to do is if I find a user in T1 I must extract a line in T2 that have a value like 'Context'. How do I store the result of my regular expression if I do as below $res3 just returns '1'

my $res= (Read from application1 and has a value);
my $res2=(Read from application2 and has a value);
my $res3; (Want to store the result in here

if($res=~ /useridkey/ ){

$res3=$res2=~/Context/; (I want to store the hole line where 'Context' is in the start of the line)
print($res3);

}else{


}


Thansk in advance!

/D_S