Please send questions to
st10@humboldt.edu .
#!/usr/bin/perl -w
#######################################################
# lect02_list2
#
# playing with assigment into lists of variables
# (and the support for simple swapping that this gives!)
#
# modified by Sharon Tuttle from "Learning Perl",
# by Schartz and Phoenix
#
# last modified: 8-30-04
#######################################################
print "give beginning of range: ";
chomp($left_val = <STDIN>);
print "give ending of range: ";
chomp($right_val = <STDIN>);
# swap range ends if user got 'em backwards!
if ($left_val > $right_val)
{
($right_val, $left_val) = ($left_val, $right_val);
}
@myArr = ($left_val..$right_val);
$ct = 0;
while ($ct <= $#myArr)
{
print "\$myArr[$ct]: $myArr[$ct]\n";
$ct++;
}
$first = 3;
$second = 15;
if ($first lt $second)
{
print "string first was less!\n";
}
else
{
print "string second was less!\n";
}
if ($first < $second)
{
print "numeric first was less!\n";
}
else
{
print "numeric second was less!\n";
}
# end of lect02_list2