Help for this page

Select Code to Download


  1. or download this
    push @{ ['anonymous','array'] }, 'variable';
    
  2. or download this
    my $aRef= [ 'anonymous', 'array' ];
    print "@$aRef\n";
    push @$aRef, 'variable';
    print "@$aRef\n";
    
  3. or download this
    my $x= 3; my $y= '3.0';
    print '$x and $y have the same value'
        if  $x == $y;  # read "if" as "because"
    
  4. or download this
    my $x= 3;
    my $y= "3";
    print '$x and $y have the same value'
        if  $x eq $y;
    
  5. or download this
    my $x= 3;
    my $y= pack "j", 3;
    
  6. or download this
    my $x= 3;
    my $y= 3;
    my $z= "$y";
    
  7. or download this
    use vars qw< $x >;
    my $y;
    *x= \$y;
    
  8. or download this
    use vars qw< $x >;
    {
    ...
        }
    }
    print $x;
    
  9. or download this
    sub blog {
        my( $x )= @_;
    ...
    $x = 1
    $x = 0
    $x still 1
    
  10. or download this
    use vars qw< $x >;
    $x= 'glo';
    ...
        print $$y;          # 'glo'
        print eval '$'.$y;  # 'lex'
    }