title: How do we extract parts of a string in Perl?
body: <p>I am new in <code>Perl</code>. I have a string of this format:<br>
  <code>[ timestamp  | integer | string  ] Some other string here</code>  </p>
  
  <p>Sample string:  </p>
  
  <pre><code>[ 2013/05/28 21:39:02 | 2212 | MALFUNCTION  ] Please check for malfunction
  </code></pre>
  
  <p>The <code>timestamp</code> is actually a timestamp e.g. <code>2013/05/28 20:38:02</code><br>
  The integer is a number and the string can be a specific word out of a sequence of words.<br>
  I am interested in extracting the string part of this.  </p>
  
  <p>In <code>Java</code> I would do it as simple as:  </p>
  
  <pre><code>String s = sentence.substring(line.lastIndexOf("|") + 1, line.lastIndexOf("]")).trim();  
  </code></pre>
  
  <p>This just loops over the string character by character and gets the part of interest.<br>
  But I don't how how this kind of "problems" are solved in <code>Perl</code>.<br>
  How would I do this? Only via regular expressions?</p>