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

#######################################################
# lect03_ARGV1
#
# demo using @ARGV, array holding invocation arguments
#
# modified by Sharon Tuttle from "Learning Perl",
#    by Schartz and Phoenix
#
# last modified: 9-7-04
#######################################################

# if there are no command-line arguments, ask user for 
#    desired input file, and set $ARGV[0] to that, 
#    so <> will read from it!

if (@ARGV == 0)   # yup, here's an array in a scalar
                  #    context again...
{
    print "enter name of file to be handled: ";
    $file = <STDIN>;

    #   a kluge! UNTIL we get to proper *file* input/output...
    $ARGV[0] = $file;
}

# now, one way or another, ARGV contains at least one file
#    name for <> to work on!

while (<>)
{
   $line = $_;

   print "processing: $line";   # taking advantage of newline...
}

# end of lect03_ARGV1