title: perl Skipping values in array
body: <p>I have a text file </p>
  
  <pre><code>II : RE: released for CR CHG1001739981 : Urgent for NYK SOD - INC1012082403
  CN: RE: futures  - INC1012083269
  AP: RE: REQ25116618-1: setups - INC1012084465
  DS: RE: access - INC1012084976
  LC: RE: options Grid - INC1012085569
  II: RE: issues - INC1012085587
  VK: RE: FW data - INC1012085827
  NW: RE: spread  - INC1012086027
  AP: RE: Exception Notification - INC1012087025
  VK: RE: Yellow - INC1012087066
  DS: RE: Exception Notification - INC1012087664&lt;/none&gt;
  LC: RE:  - INC1012087915
  CN: RE: [Restricted - Internal] - INC1012088249
  WJ: FW: issue - INC1012088961
  can i get an inc for this pls
  you sure can
  CN: User Feedback - INC1012089212
  thank you
  np
  CN: benchmark - INC1012089691
  DS: NAN Value - INC1012089989
  TM:downstream - INC1012090321
  re-assigning to myself
  II: setup - INC1012090460
  LC: size - INC1012090813
  BJ - help with filter
  **handover mail**
  :)
  </code></pre>
  
  <p>This is how tickets are assigned in this group. Most of the team gets here at 7AM, BJ gets here at 10:30 and the
  handover to the US is at 11:00. Since BJ just gets in he is often shifted to the top of the queue - he gets the first ticket. 
  What I have to do is figure out what the order is for the rest of the shift. Usually by hand I remove the people from england who get off work at 11am easter time.<br>
  Then I strip off the test from the remining US people, and put them in horizontal order. </p>
  
  <pre><code>II AP DS LC II AP DS LC WJ DS AP II LC BJ
  </code></pre>
  
  <p>then reverse them </p>
  
  <pre><code> BJ LC II AP DS WJ LC DS AP II LC DS AP II
  </code></pre>
  
  <p>then skipping the BJ, go to the [1] in the list in this case LC, and the go back to where we get "LC" again. </p>
  
  <pre><code> BJ LC II AP DS WJ 
  </code></pre>
  
  <p>the reverese it again  - and voila you hyave the assignment order for the day. </p>
  
  <pre><code>WJ DS AP II LC BJ
  </code></pre>
  
  <p>Right now I am having trouble stopping priting at the first instance of "LC"</p>
  
  <pre><code>#!/usr/bin/perl
  use strict;
  use warnings;
  use Data::Dumper ;
  my @team = ("AP","II","DS","WJ", "JK","LC","BJ") ;
  my @orderdTeam ;
  my $begin ;
  my $rev ;
  my @rev_orderdTeam  ;
  my $filename = shift @ARGV ;
  open(my $fh, '&lt;', $filename) or die "Could not open file $filename $!";
  while (my $line = &lt;$fh&gt; ) {
      foreach my $op (@team) {
          if ($line =~ /$op/) {
          push (@orderdTeam, $op) ;
          }
      }
  
      }
  
  
  print "order ---------&gt; " . "@orderdTeam" . "\n"       ;
  @rev_orderdTeam = reverse(@orderdTeam)              ;
  print "reverse order -&gt; " . "@rev_orderdTeam" . "\n"   ;
  
  print "The last person to get assigned is $begin\n" ;
  
  foreach $rev (@rev_orderdTeam[1 .. $#rev_orderdTeam]) {
      if ("$rev_orderdTeam[0]" eq "BJ") {
             $begin = $rev_orderdTeam[1]
      }
      else {
            $begin = "$rev_orderdTeam[0]" ;
      }
  
      if ($rev ne "$begin") {
              print "$rev " ;
  
      }
  }
  </code></pre>