in reply to Re^6: Can't figure out how to include LAST member of the array
in thread Can't figure out how to include LAST member of the array

I will need a bit more info on what you are trying to do in order to tell you what I think.

BTW, it is awkward to repeatedly test/trial-and-error a program which keeps asking user input from the command line. So, while testing your logic, perhaps you can hardcode some of those $input1, $input2. Or you can read them from a file (in this case you can test many different values), or if you are on a *nix command line printf "1\n5\n" | yourscript.pl or enter the values 1 and 5 in separate lines in myfile.txt and then cat myfile.txt | yourscript.pl

Replies are listed 'Best First'.
Re^8: Can't figure out how to include LAST member of the array
by afoken (Chancellor) on Feb 10, 2021 at 20:27 UTC
    cat myfile.txt | yourscript.pl

    Don't bother the cat. A simple I/O redirection is sufficient here:

    yourscript.pl < myfile.txt

    And as a bonus, the version without cat also works on Windows.

    See also Re: Perl output and uniq.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

      oops bitten by the cats! Thank you for not linking the useless use of cat!