Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have two input data file, they are used in two seperate function, I need to read in the data line by line, if I use ARGV, how will I use it.Please Help!
  • Comment on How to use ARGV in more than one input data file

Replies are listed 'Best First'.
(jeffa) Re: How to use ARGV in more than one input data file
by jeffa (Bishop) on May 05, 2002 at 00:51 UTC
    Does something like this help?
    use strict; my ($file1,$file2) = @ARGV; do_first($file1); do_second($file1); sub do_first { my $file = shift; open(FH,$file) or die "can't open $file: $!"; print while <FH>; } sub do_second { my $file = shift; open(FH,$file) or die "can't open $file: $!"; my @lines = <FH>; print reverse @lines; }

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    
A reply falls below the community's threshold of quality. You may see it by logging in.