I have a perl script

```
$ cat ~/script.pl
sub main {

    my ($file) = @_;

    <STUFF>

    }

}

foreach (@ARGV) {

    main($_);

}

```

I want to execute `~/script.pl` on every `.txt` file under the directory `~/foo`. I can get the list of `.txt` files under `~/foo` with the command

```
$ find ~/foo -type f -name \*.txt

```

Can I somehow use this command to pass these files to my script?