Help for this page

Select Code to Download


  1. or download this
    foreach (qw/foo bar/) {
      print;
      print foreach (qw/one two three/);
    }
    # output: fooonetwothreebaronetwothree
    
  2. or download this
    foreach (qw/foo bar/) {
      print;
    ...
      print while (shift @list); 
    }
    # output: foofoofoofoobarbarbarbar
    
  3. or download this
     
    foreach (qw/foo bar/) {
      print;
    ...
      print while (local $_ = shift @list); 
    }
    # output: fooonetwothreebaronetwothree
    
  4. or download this
    { local $_; print while (shift @list); }
    
  5. or download this
    # will not localize $_ to the while loop
    local $_; print while (shift @list);