Advertisement

10.10.2005 at 09:50PM PDT, ID: 21590478
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

Diff from file on basis of regular Exp

Asked by pralay in Perl Programming Language

Tags: ,

Hi All,

       I am writing a script which just diffrenciate the list available in a text file. Following is the script:

#!/usr/local/bin/perl -w

use strict;
use lib qw(/usr/local/bin);
use Time::Local;
my $activebyid = "activtbyid";
my $inactivebyid = "ids.txt";

my @static_nonhuman_strings = qw(
P2P       PUR       wms       sap       admin     test      ftp       batch     btch      client    disaster
servere   access    operator  auto      java      prod      webi      web
frito     ldap      user      orbit     dmart     comm      pager     help
quest     ora       orb       mart      db2       con       del
dev       dmar      dnl       dpp       drobe     etm       flr       hdc
hfp       ist       ite       ncr       oms       omw       page      pem
prd       pnaf      prm       psp       pt        pwm       sld       slp       ssdt
sts       tgt       wcs       wfm       wod       wpm       ziq       pp        adm       mgr
);


sub split_3_ways {
   my $filename = shift;
   my $tre__aref = shift;
   my $ss__href = shift;
   my $h__aref = shift;

   open FH,"<$filename" || die "\nERROR> Failed opening [$filename] for read access: $!\n";

   # Each line has username (only) in it, as:
   # username_1
   # username_2
   # ...
   # username_n

   USERLINE: while (my $username = <FH>) {
      chomp $username;
      $username = $1;

      # first check for a match against TRE
      ($username =~ /\w\d[asr]$/) && do {
         push @{$tre__aref},$username;
         next USERLINE;
      };

      # second check for a match against the static strings
      for my $current_string (@static_nonhuman_strings) {
         ($username =~ /$current_string/i) && do {
            if (! defined ${$ss__href}{$current_string}) {
               my @anon_array = ();
               ${$ss__href}{$current_string} = \@anon_array;
            }
            push @{$$ss__href{$current_string}}, $username;
            next USERLINE;
         };

      }
      # lastly, username is assumed to be a human
      push @{$h__aref},$username;
   }

   close FH;

} # end split_3_ways

print "\n\nStatic strings:\n";
print "@static_nonhuman_strings\n";

print "\n\nDetermine if static strings and TRE are mutually exclusive.\n";
print "Do this by checking each static string against Troy's RE:\n";
my $number_of_matches = 0;
for (@static_nonhuman_strings) {
   /\w\d[asr]$/ && do {
      print "TRE match [$_]\n";
      $number_of_matches++;
      next;
   };
   print "nomatch [$_]\n";
}
print "\n[$number_of_matches] static strings matches TRE.\n\n";

my @tre_ids;
my %ss_ids;  
my @h_ids;  

   @tre_ids = ();
   %ss_ids = ();
   @h_ids = ();

   split_3_ways (
   $inactivebyid,
      \@tre_ids,
      \%ss_ids,
      \@h_ids );

   open HUMANINACTIVE,">human_inactive" or do
      {
         print "\nERROR> Failed opening human inactive for write access: $!\n";
         exit 0;
      };

   for (sort @h_ids) {
      print HUMANINACTIVE "$_\n";
   }

   close HUMANINACTIVE;


   open TREINACTIVE,">TRE_inactive" or do
      {
         print "\nERROR> Failed opening TRE inactive for write access: $!\n";
         exit 0;
      };

   for (sort @tre_ids) {
      print TREINACTIVE "$_\n";
   }

   close TREINACTIVE;

   open STATICSTRINGSINACTIVE,">static_strings_inactive" or do
      {
         print "\nERROR> Failed opening static strings inactive for write access: $!\n";
         exit 0;
      };

I am getting so many warning
Use of uninitialized value in concatenation (.) or string at x line  102.

I also not getting desired result. Its putting whatever in source file that ids.txt into HUMANINACTIVE. Althought there are so many match for the string which is specified in @static_nonhuman_strings.

Is anything wrong with logic?

Hoping for reply .....

Regards,
Pralay DesaiStart Free Trial
 
Keywords: Diff from file on basis of regular Exp
 
Loading Advertisement...
 
[+][-]10.11.2005 at 12:10AM PDT, ID: 15058147

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.11.2005 at 12:21AM PDT, ID: 15058204

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.11.2005 at 12:36AM PDT, ID: 15058277

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Perl Programming Language
Tags: perl, diff
Sign Up Now!
Solution Provided By: ozo
Participating Experts: 2
Solution Grade: A
 
 
[+][-]10.11.2005 at 01:39AM PDT, ID: 15058523

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.11.2005 at 02:03AM PDT, ID: 15058604

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.11.2005 at 04:15AM PDT, ID: 15059119

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.11.2005 at 07:34AM PDT, ID: 15060736

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.11.2005 at 08:39AM PDT, ID: 15061489

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.14.2005 at 01:47AM PDT, ID: 15083782

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.18.2005 at 07:03PM PDT, ID: 15113030

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.18.2005 at 08:24PM PDT, ID: 15113249

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.24.2006 at 08:10PM PDT, ID: 16531305

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]04.28.2006 at 03:03AM PDT, ID: 16560846

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32