Help for this page

Select Code to Download


  1. or download this
    my $var = "foo";
    print 'Variable name is $var';   # prints: Variable name is $var
    print "Variable is $var";         # prints: Variable is foo
    
  2. or download this
    my $var = 10;
    print "There are $varapples";     # error: the compiler cannot know wh
    +ere the variable name ends
    ...
    print "There are ${var}apples";   # prints: there are 10apples. 
                                      # A space is missing, but the print 
    +statement works, because the compiler can know 
                                      # where the variable name ends thank
    +s to the curlies;