Hello - I'm trying to use Perl to run through a list of numbered folders (41..61) that have a txt file in each with a name like "ms_stem41" or "ms_stem10B.pl". I am grepping a line from these files then manipulating them. The files all start with "ms_stem". When I type "grep 'word' <path/ms_stem* " into a terminal, it works fine. When I try to put this into a Perl Script, it reads "ms_stem*" literally and won't match to anything. I've tried a lot of ways of doing this like .* .+ [0-9]* , nothing makes the system call the right files. I feel I'm doing something wrong with the quotes or the metacharacters, but can't seem to make it work. Please help! Thanks! Here's my code:
#!/usr/bin/perl -w
#for folders 41..60
for ($k=41; $k<61; $k++){
system("grep 'word' <Users/scripts/$k/ms_stem* >output1");