Help for this page

Select Code to Download


  1. or download this
      my @w = () = 1;
      print "[", @w, "]\n";               # prints: []
    
    ...
      my $temp;
      my @z = (undef, $temp, undef) = (7,8,9);
      print "[", @z, "]\n";               # prints: [789]
    
  2. or download this
      my $count = () = "abacadaeafag" =~ /a/g;
      my @empty = () = "abacadaeafag" =~ /a/g;
      print "[", $count, "]\n";           # prints: [6]
      print "[", @empty, "]\n";           # prints: []
    
  3. or download this
      $_ = "abacadaeafag";                # or whatever
      if ( scalar( () = /a/g ) > 7 ) {    # more than 7 'hits'?
         # do something...
      }