Help for this page

Select Code to Download


  1. or download this
    # @array evaluated in scalar context.
    my $count = @array;
    
  2. or download this
    # The s/// operates on $copy.
    (my $copy = $str) =~ s/\\/\\\\/g;
    
  3. or download this
    # Prints $x.
    print($x = $y);
    
  4. or download this
    # @array evaluated in list context.
    my @copy = @array;
    
  5. or download this
    # @array evaluated in list context.
    my ($first) = @array;
    
  6. or download this
    # Only dies if f() returns an empty list.
    # This does not die if f() returns a
    # false scalar like zero or undef.
    my ($x) = f() or die;
    
  7. or download this
    my $count = () = f();
    
  8. or download this
    # Prints @x.
    print(@x = @y);