If you just want to repolace "nlf" with a variable, you can just replace it
with a variable?

if ($err eq $variable){

Or else you need to be more specific about what you need.

-----Original Message-----
From: Larry Steinberg [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 30, 2002 8:06 AM
To: [EMAIL PROTECTED]
Subject: How to replace a literal with a variable


Hi,

How can I replace the literal "nlf" with a variable in the code below?
Thanks in advance.

sub parseLogLine {
    $line = $_;

    %searchInfo = ();
    @searchInfo = split / +/, $line;

    # found any listings?
    $numListings = $searchInfo[8];
    $numCategories = $searchInfo[10];

    # did I detect any errors or exceptions
    ($err) = ( $line =~ / ERR (\w+) /i );

    if ( $err ne "") {
        $err =~ tr/A-Z/a-z/;
 if ($err eq "nlf") {
     $NLFerr++;
 }
 elsif ($err eq "cat") {
     $CATerr++;
 }
    }


-Larry



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

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

Reply via email to