title: how to store and use variable in pig
body: <p>i have a tuple stored in A:</p>
  
  <pre><code>{group: chararray,word_count: long}
  </code></pre>
  
  <p>so, I sum all word_count variable, and store it in a variable T:</p>
  
  <pre><code>T: {long}
  </code></pre>
  
  <p>now, I have a variable X that looks like:</p>
  
  <pre><code>(word1,12,word1,1)
  (word2,22,word2,4)
  (word3,32,word3,14)
  </code></pre>
  
  <p>I need to do math operation on 1, 4 and 14 against the value stored in T,
  but my for each doesn't recognize T.</p>
  
  <pre><code>result = FOREACH X GENERATE $3*T;
  </code></pre>
  
  <p>It fails. It doesn't recognize T, because there is no field called T in X.</p>
  
  <p>so, what i did is, i cross the X and T
      temp =  CROSS X, T</p>
  
  <p>is this the correct way?? I'm new to pig. My solution, doesn't seem to be very elegant. </p>