#!/usr/bin/perl -w

#######################################################
# class5_04_ARGV1
#
# demo using @ARGV, array holding invocation arguments
#
# modified by Sharon Tuttle from "Learning Perl",
#    by Schartz and Phoenix
#
# last modified: 4-21-03
#######################################################

#   class5_04_ARGV1

# if no command-line arguments, ask user for desired input file,
# set $ARGV[0] to that, so <> will read from it!
if (@ARGV == 0)
{
    print "enter name of file to be handled: ";
    $file = <STDIN>;

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

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

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

# end of class5_04_ARGV1
