Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 8574428d

Von Sven Schöling vor mehr als 15 Jahren hinzugefügt

  • ID 8574428d362288bd954d00225dc2035b0b716334
  • Vorgänger e43cccf4
  • Nachfolger 8fa48153

Und kommentiert.

Unterschiede anzeigen:

bin/mozilla/common.pl
580 580
  $lxdebug->leave_sub();
581 581
}
582 582

  
583
=item cross BLOCK ARRAY ARRAY
584

  
585
Evaluates BLOCK for each combination of elements in ARRAY1 and ARRAY2
586
and returns a new list consisting of BLOCK's return values.
587
The two elements are set to $a and $b.
588
Note that those two are aliases to the original value so changing them
589
will modify the input arrays.
590

  
591
  # append each to each
592
  @a = qw/a b c/;
593
  @b = qw/1 2 3/;
594
  @x = pairwise { "$a$b" } @a, @b;
595
  # returns a1, a2, a3, b1, b2, b3, c1, c2, c3
596

  
597
As cross expects an array but returns a list it is not directly chainable
598
at the moment. This will be corrected in the future.
599

  
600
=cut
583 601
sub cross(&\@\@) {
584 602
  my $op = shift;
585 603
  use vars qw/@A @B/;

Auch abrufbar als: Unified diff