title: Searching multiple strings
body: <p>How can i search from set of strings</p>
  
  <p>i would like a perl script to search for either <code>"aaa", "bbb", "ccc", "ddd"</code></p>
  
  <p>Searching from txt file</p>
  
  <p>Example 1</p>
  
  <pre><code>some random text
  blah
  blah 
  blah
  //Car/trunk/sandbox/users/Tom/xyz/bbb/toyota
  </code></pre>
  
  <p>Desired Output: </p>
  
  <pre><code>//Car/trunk/sandbox/users/Tom/xyz/...
  </code></pre>
  
  <p>Example 2</p>
  
  <pre><code>some random text
  blah
  blah 
  blah
  //Car/trunk/sandbox/users/Alex/abc/defg/ddd/honda/accord
  </code></pre>
  
  <p>Desired Output: </p>
  
  <pre><code>//Car/trunk/sandbox/users/Alex/abc/defg/...
  </code></pre>
  
  <p>Basically searching from the given set of strings from <code>"aaa", "bbb", "ccc", "ddd"</code> it finds <code>"bbb"</code> in example 1 and takes everything before and adds back slash with <code>"..."</code></p>
  
  <p>Please note that it is reading from one text file, example 1 is a example of text file and same goes for example 2.</p>
  
  <p>So far this is what i have.</p>
  
  <pre><code>my $infile = 'new5.txt';
      my @strings  = qw/aaa bbb ccc ddd/;
      local @ARGV = ($infile);
      while( &lt;&gt; ){
  
          print;
      }
  </code></pre>