Do you mean something like this?
#################################### open(LOG,"log.txt"); my %errs = (); while(<LOG>){ chomp $_; my($details,$err) = split(/\|/,$_); $err =~ s/^\s+//; $errs{$err}++ if $err; } print "Total for each error:\n"; print "---------------------\n\n"; foreach(sort keys %errs){ print "$_.....$errs{$_}\n"; } #################################### That will split each line on a pipe, then remove whitespaces at the beginning of the variable, then store it as a hash key. -----Original Message----- From: Larry Steinberg [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 30, 2002 10:17 AM To: [EMAIL PROTECTED] Subject: Re: How to replace a literal with a variable Here is what I need. I hope this explains it better. I have a script which creates a report for No Listings Found errors. I'd like to adapt it to create a report for any "ERR " code condition in the log. The errors and values are below. TIA! >>>Error | Value<<< city not in state | TSE ZIP not in state | ZSE ZIP not in city | ZTE can't find address in distance search | BAD not enough address info in distance search | DBK keyword but no category or name | KEY more than one address in distance search | MUL network problem | NET no such category | CAT no such category and no such city | NCC no such category and city not in state | NCG no such city | CIT no listings found | NLF no listings found and no such phone number | NSP no fields, state only, or no state | NST no such state | NSS no such ZIP | ZIP only one phone field | PHN too many listings | TML search timeout | TIM no state and no ZIP | MSZ no coverage | MCV search failure | MSF failure to connect to server | MSV unknown error ("oops" page) | UNK no results found | NRF "Nkuipers" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I'm probably not understanding what exactly you need....but...as I see it, > $err holds whatever error message that you captured with a regex. So if you > want to make a variable with the same name as the literal, dereference a > variable with the name held in $err and the new var will autovivify: > > ($err) = ( $line =~ / ERR (\w+) /i ); > my $$err; > > I think. > -- 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]