How to run perl script on multiple files of two directories?

Hi

I have 100 files under file A labled 1.txt 2.txt.....100.txt(made up name)
I have 1 files under file B labled name.txt

How can i run the same perl script on 100 files and file name.txt

I want to run
perl script.pl A/1.txt B/name.txt
perl script.pl A/2.txt B/name.txt
.......
perl script.pl A/100.txt B/name.txt

How can I do it with one command or anyway to makes it works, shell script?

Try a nested for loop

for A in A/*
do
    for B in B/*
    do
        perl script.pl "$A" "$B"
    done
done

Do i need to put it in my perl script?
Or it is a linux command?
Sorry for the silly question.
And I want to generate output file name according to the file in A
such as
perl script.pl A/1.txt B/name.txt > C/1.gff

---------- Post updated at 04:19 PM ---------- Previous update was at 04:16 PM ----------

Do i need to put it in my perl script?
Or it is a linux command?
Sorry for the silly question.
And I want to generate output file name according to the file in A
such as
perl script.pl A/1.txt B/name.txt > C/1.gff

This is a linux shell script.

Either put it in a file (run_perl.sh) and use chmod 755 run_perl.sh to make it executable or just type directly into the shell.

Note the shell will put continuation characters (usually >) at the start of each additional line until it sees the matching done for the first for

you can test what it will do by using echo perl script.pl "$A" "$B" instead of perl script.pl "$A" "$B"