in reply to diamond operator

You are on the right idea. Perl is different than C in many respects. One noticeable things is that subscripts like $ARGV[0] are strangely absent. Here are some command line things that would call my_prog..

>perl my_prog somename name2 name3 name4
>perl my_prog somename name2
>perl my_prog somename
>perl my_prog *.txt
Here is the code:

#!/usr/bin/perl -w use strict; die "must have at least 2 files\n" if @ARGV <2; my ($first_file, @other_files) = @ARGV; open(IN, '<', "$first_file") || die "can't open $first_file $!"; while (<IN>) { #work on each line in the first file } foreach my $file (@other_files) { open (IN, "<", $file) or die "can't open $file $!"; while (<IN>) { #work on each line in the sub files } }
BTW:
- in C $argv[0] is program name, in Perl $0 is, "well sort of" and is more complex than it sounds amongst O/S'es, but that is the basic idea.
- in Perl @ARGV contains the number of args (could be expanded by shell)