Monks I have array that looks like this (output of a sql query).
16410 88 bhorwat, dpotte1, jbehr, lgrimes 16412 88 pputta1 16413 88 gkothi, aandy

Where the first number is a unique bug id number and the names are all the developers that are assigned the bug id. I want to search the bug id and check if the developer is assigned the bug. I was able to get the bug id out as it is unique. But if i search for the developer then one developer maybe assigned multiple bugs so this where i am stuck. I want if the developer is assigned the same bug

What i want to do is search for the bug id and if the developer is assigned the same bug then compare to the developer who is commiting the code. e.g. commiter is gkothi and is assigned bug 16413 (which is equal to strippeddirectory). this is what i have
#!D:\perl\bin\perl use strict; #use warnings; use DBI; use List::Util qw(first); # Replace datasource_name with the name of your data source. # Replace database_username and database_password # with the SQL Server database username and password. my $data_source = q/dbi:ODBC:test/; my $user = q/tracker/; my $password = q/TrAck3r/; #Absolute path to the svnlook program my $svnlook = "D:\\Subversion\\bin\\svnlook.exe"; my $debugEnabled = 0; my $argNum = 0; my ($repo_path, $txn_name) = @ARGV; my $teamtrack = "sa_svndev"; ## Check to see if debug is enabled foreach $argNum (0 .. $#ARGV) { if ( ($ARGV[$argNum] eq "-d") || ($ARGV[$argNum] eq "-D")) { $debugEnabled = 1; } } if ($debugEnabled) { print "\n------ DEBUG IS ENABLED ------\n"; ## Use revision numbers since there is not a transaction number $txn_name = "-r $txn_name"; } else { ## Use transaction numbers $txn_name = "-t $txn_name"; } my $committer = `$svnlook author $txn_name $repo_path` or die("Unable to get committer with svnlook.\n"); chomp($committer); if ($committer eq $teamtrack ) { print "Not Checking since user is teamtrack"; exit 0; } #print "\n\n$committer"; my $changeddirectory = `$svnlook dirs-changed $txn_name $repo_path` or die("Unable to get the changed directories with svnlook.\n"); #print "\n\nDirectory changed $changeddirectory"; my $strippeddirectory = $1 if ($changeddirectory =~ /(\d+)/); #print "$strippeddirectory"; # Connect to the data source and get a handle for that connection. my $dbh = DBI->connect($data_source, $user, $password) or die "Can't connect to $data_source: $DBI::errstr"; # This query generates a result set with one record in it. my $sql = "select ucs.ts_issueid as CNR_NUMBER, ucs.ts_state as CNR_STATE, LTRIM((SELECT STUFF((SELECT ', ' + List FROM (SELECT List = substring((SELECT ( ', ' + TS_LOGINID ) FROM dbo.TS_USERS t2 WHERE t1.val = t2.TS_ID + FOR XML PATH( '' ) ), 3, 1000 )FROM (SELECT * FROM dbo.Split(uc +s.ts_developers_ext, ',') WHERE VAL <> '') t1) as subquery FOR XML PATH('')), 1, 1, ''))) as DEVELOPERS from usr_cnr_solution ucs inner join ts_states s on s.ts_id = ucs.ts_state where s.ts_id = 88 "; # Prepare the statement. my $sth = $dbh->prepare($sql) or die "Can't prepare statement: $DBI::errstr"; # Execute the statement. $sth->execute(); # Fetch and display the result set value. while ( my @row = ($sth->fetchrow_array )) { print "@row\n"; my $cnrissue = first { /$strippeddirectory/ } @row; my $cnrdev = first { /$committer/ } @row; print "$cnrissue"; print "$cnrdev"; } # Disconnect the database from the database handle. $dbh->disconnect;
Any help is greatly appreciated

In reply to Search an Array Question by rogermills

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.