Please send questions to st10@humboldt.edu .
#!/usr/bin/perl -w

#######################################################
# lect02_context
#
# showing how different list and scalar expressions
# behave in list and scalar contexts...
#
# modified by Sharon Tuttle from "Learning Perl",
#    by Schartz and Phoenix
#
# last modified: 4-11-03
#######################################################

@values = (3..8);    # the values 3 through 8

@myArr = @values;    # also has the values 3 through 8
print "\@myArr contains: ";
foreach ( @myArr )
{
    print "$_ ";
}
print "\n";

$myScalar = @values; # gets the NUMBER OF ELEMENTS in $values!
print "\n\$myScalar contains: $myScalar\n";


@words = qw/ hello goodbye toodles /;

@backwards = reverse @words; # the values toodles, goodbye, hello
print "\n\@backwards contains: ";
foreach ( @backwards )
{
    print "$_ ";
}
print "\n";

$backwards = reverse @words; # the reversed STRING "seldooteybdoogolleh"
print "\n\$backwards contains: $backwards\n";

@tryme = reverse @words;
$result = @tryme;
print "\n\$result: $result\n";

# end of lect02_context